Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
1c099e7
Copied integration and fixed compilation errors
maurei Sep 8, 2021
54a023f
Add models and adjusted models in OpenAPI document tests such that i …
maurei Sep 8, 2021
09ab5c0
Add FlightAttendantController to used controllers
maurei Sep 9, 2021
19cc14d
Added client library with tests to project; made adjustmets to the mo…
maurei Sep 9, 2021
ec2ccaf
Adjusted build script to create OpenApiClient artifact, added documen…
maurei Sep 9, 2021
c6d691d
Adjusted docs and minor refactors
maurei Sep 10, 2021
ef2753e
Replace resource name formatter with internal one
maurei Sep 10, 2021
b3cdc7a
Removed JsonApiInputFormatter workaround
maurei Sep 10, 2021
a955616
Merge branch 'openapi' into oa/existing-integration
maurei Sep 13, 2021
bad9aad
Moved full document test to ExistingOpenApiIntegration test folder, w…
maurei Sep 14, 2021
ea46194
Disabled OpenAPI for nonjson and operations controller, as these are …
maurei Sep 14, 2021
a0d5bff
review feedback on docs
maurei Sep 14, 2021
280e449
Add a very minimal example of a generated OpenAPI client for JsonApiD…
maurei Sep 14, 2021
7b3d1ef
Fixed inspect and cleanup code issues that do not appear when execute…
maurei Sep 15, 2021
ba42b77
rename existing to legacy in ExistingOpenApiIntegration folder and na…
maurei Sep 15, 2021
ecd971e
moved OpenApiClient to OpenApi.Client
maurei Sep 15, 2021
37a95b3
Configure NSwag to generate a client with access modifier set to inte…
maurei Sep 15, 2021
da1db37
Move OpenAPI client tests to dedicated test project, cleared up some …
maurei Sep 15, 2021
f71bbea
Some adjustments to stay closer to 1-on-1 model mapping from the priv…
maurei Sep 15, 2021
348dffa
review feedback
maurei Sep 15, 2021
e88c762
Process inspectcode issues that do not appear when run locally
maurei Sep 15, 2021
54ac898
Update package reference in build script
maurei Sep 16, 2021
83ac507
Changed models to stay closer 1-to-1 mapping. Changed 'OpenApiClient…
maurei Sep 16, 2021
aaf59a6
process review feedback
maurei Sep 16, 2021
1baed2d
rename ClassName in client test project
maurei Sep 16, 2021
65430a8
Updated example client project using Visual Studio defaults and updat…
Sep 16, 2021
520c618
Layout tweaks and fixes
Sep 16, 2021
b72d823
fixed failed automatic rename 'openApiOpenApi'
maurei Sep 17, 2021
43cec51
Merge branch 'oa/existing-integration' of https://github.com/json-api…
maurei Sep 17, 2021
605d2ce
reduced changed wrt private version of this test
maurei Sep 17, 2021
8c2a7b4
Changed ID type from to for Flight
maurei Sep 17, 2021
a83de89
ReserveCabinPersonnel -> Purser, CabinPersonnel -> CabinCrewMembers
maurei Sep 17, 2021
8ceff7b
fixed failed automatic rename 'openApiOpenApi'
maurei Sep 17, 2021
5a4a06f
Flight: replaced OperatingAirplane with Purser, added to many relatio…
maurei Sep 17, 2021
7a88a64
Review feedback
maurei Sep 17, 2021
4073c3f
Fix client lifetime test
maurei Sep 17, 2021
d3ebfaf
Feedback
maurei Sep 17, 2021
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
moved OpenApiClient to OpenApi.Client
  • Loading branch information
maurei committed Sep 15, 2021
commit ecd971eb2703ba8b3b136fd4e59301a7002987c9
2 changes: 1 addition & 1 deletion JsonApiDotNetCore.sln
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JsonApiDotNetCore.OpenApi",
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenApiTests", "test\OpenApiTests\OpenApiTests.csproj", "{B693DE14-BB28-496F-AB39-B4E674ABCA80}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JsonApiDotNetCore.OpenApiClient", "src\JsonApiDotNetCore.OpenApiClient\JsonApiDotNetCore.OpenApiClient.csproj", "{5ADAA902-5A75-4ECB-B4B4-03291D63CE9C}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JsonApiDotNetCore.OpenApi.Client", "src\JsonApiDotNetCore.OpenApi.Client\JsonApiDotNetCore.OpenApi.Client.csproj", "{5ADAA902-5A75-4ECB-B4B4-03291D63CE9C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JsonApiDotNetCoreExampleClient", "src\Examples\JsonApiDotNetCoreExampleClient\JsonApiDotNetCoreExampleClient.csproj", "{7FC5DFA3-6F66-4FD8-820D-81E93856F252}"
EndProject
Expand Down
2 changes: 1 addition & 1 deletion docs/usage/toc.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

# OpenAPI
## [API Description](openapi/api-description.md))
## [Client Library](openapi/client-library.md))
### [Client Library](openapi/client-library.md))

# Extensibility
## [Layer Overview](extensibility/layer-overview.md)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using JsonApiDotNetCore.OpenApiClient;
using JsonApiDotNetCore.OpenApi.Client;
using Newtonsoft.Json;

namespace JsonApiDotNetCoreExampleClient.GeneratedCode
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using JsonApiDotNetCore.OpenApiClient;
using JsonApiDotNetCore.OpenApi.Client;

namespace JsonApiDotNetCoreExampleClient.GeneratedCode
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\JsonApiDotNetCore.OpenApiClient\JsonApiDotNetCore.OpenApiClient.csproj" />
<ProjectReference Include="..\..\JsonApiDotNetCore.OpenApi.Client\JsonApiDotNetCore.OpenApi.Client.csproj" />
</ItemGroup>
</Project>
21 changes: 21 additions & 0 deletions src/JsonApiDotNetCore.OpenApi.Client/ArgumentGuard.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System;
using JetBrains.Annotations;

#pragma warning disable AV1008 // Class should not be static

namespace JsonApiDotNetCore.OpenApi.Client
{
internal static class ArgumentGuard
{
[AssertionMethod]
[ContractAnnotation("value: null => halt")]
public static void NotNull<T>([CanBeNull] [NoEnumeration] T value, [NotNull] [InvokerParameterName] string name)
where T : class
{
if (value is null)
{
throw new ArgumentNullException(name);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using System.Linq.Expressions;

namespace JsonApiDotNetCore.OpenApiClient
namespace JsonApiDotNetCore.OpenApi.Client
{
public interface IJsonApiClient
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
using System.Linq.Expressions;
using System.Reflection;
using JetBrains.Annotations;
using JsonApiDotNetCore.OpenApi;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

namespace JsonApiDotNetCore.OpenApiClient
namespace JsonApiDotNetCore.OpenApi.Client
{
/// <summary>
/// Base class to inherit auto-generated client from. Enables to mark fields to be explicitly included in a request body, even if they are null or
Expand Down Expand Up @@ -116,7 +115,7 @@ public override bool CanConvert(Type objectType)

public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
throw new UnreachableCodeException();
throw new Exception("This code should not be reachable.");
}

public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
Expand Down Expand Up @@ -221,4 +220,4 @@ protected override JsonProperty CreateProperty(MemberInfo member, MemberSerializ
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<PropertyGroup>
<PackageTags>jsonapidotnetcore;jsonapi;json:api;dotnet;asp.net;openapi;swagger;client;nswag</PackageTags>
<Description>Contains utility methods to enrich the usability of an OpenAPI generated client.</Description>
<Description>Provides support for partial PATCH and partial POST requests for a C# client generated with NSwag.</Description>
<Authors>json-api-dotnet</Authors>
<PackageProjectUrl>https://www.jsonapi.net/</PackageProjectUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
Expand All @@ -17,11 +17,6 @@
<DebugType>embedded</DebugType>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\JsonApiDotNetCore.OpenApi\JsonApiDotNetCore.OpenApi.csproj" />
<ProjectReference Include="..\JsonApiDotNetCore\JsonApiDotNetCore.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0">
<PrivateAssets>all</PrivateAssets>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using JsonApiDotNetCore.OpenApiClient;
using JsonApiDotNetCore.OpenApi.Client;

namespace OpenApiTests.ClientLibrary.GeneratedCode
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using JsonApiDotNetCore.OpenApiClient;
using JsonApiDotNetCore.OpenApi.Client;
using Newtonsoft.Json;

namespace OpenApiTests.ClientLibrary.GeneratedCode
Expand Down
1 change: 1 addition & 0 deletions test/OpenApiTests/OpenApiTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\JsonApiDotNetCore.OpenApi.Client\JsonApiDotNetCore.OpenApi.Client.csproj" />
<ProjectReference Include="..\..\src\JsonApiDotNetCore.OpenApiClient\JsonApiDotNetCore.OpenApiClient.csproj" />
<ProjectReference Include="..\..\src\JsonApiDotNetCore.OpenApi\JsonApiDotNetCore.OpenApi.csproj" />
<ProjectReference Include="..\TestBuildingBlocks\TestBuildingBlocks.csproj" />
Expand Down