Skip to content

Commit cdc6962

Browse files
authored
Merge pull request #1680 from json-api-dotnet/merge-master-into-openapi
Merge master into openapi
2 parents 75c1837 + 3b8b0d7 commit cdc6962

File tree

12 files changed

+84
-72
lines changed

12 files changed

+84
-72
lines changed

.config/dotnet-tools.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"isRoot": true,
44
"tools": {
55
"jetbrains.resharper.globaltools": {
6-
"version": "2024.3.3",
6+
"version": "2024.3.5",
77
"commands": [
88
"jb"
99
],
@@ -17,7 +17,7 @@
1717
"rollForward": false
1818
},
1919
"dotnet-reportgenerator-globaltool": {
20-
"version": "5.4.3",
20+
"version": "5.4.4",
2121
"commands": [
2222
"reportgenerator"
2323
],

.github/workflows/build.yml

+10-7
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,10 @@ jobs:
4545
- name: Setup .NET
4646
uses: actions/setup-dotnet@v4
4747
with:
48+
# Block buggy release from February 11, 2025
4849
dotnet-version: |
49-
8.0.x
50-
9.0.x
50+
8.0.309
51+
9.0.103
5152
- name: Show installed versions
5253
shell: pwsh
5354
run: |
@@ -132,7 +133,7 @@ jobs:
132133
run: |
133134
cd docs
134135
& ./generate-examples.ps1
135-
dotnet docfx docfx.json
136+
dotnet docfx docfx.json --warningsAsErrors true
136137
if ($LastExitCode -ne 0) {
137138
Write-Error "docfx failed with exit code $LastExitCode."
138139
}
@@ -163,9 +164,10 @@ jobs:
163164
- name: Setup .NET
164165
uses: actions/setup-dotnet@v4
165166
with:
167+
# Block buggy release from February 11, 2025
166168
dotnet-version: |
167-
8.0.x
168-
9.0.x
169+
8.0.309
170+
9.0.103
169171
- name: Git checkout
170172
uses: actions/checkout@v4
171173
- name: Restore tools
@@ -218,9 +220,10 @@ jobs:
218220
- name: Setup .NET
219221
uses: actions/setup-dotnet@v4
220222
with:
223+
# Block buggy release from February 11, 2025
221224
dotnet-version: |
222-
8.0.x
223-
9.0.x
225+
8.0.309
226+
9.0.103
224227
- name: Git checkout
225228
uses: actions/checkout@v4
226229
with:

.github/workflows/codeql.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,10 @@ jobs:
2626
- name: Setup .NET
2727
uses: actions/setup-dotnet@v4
2828
with:
29+
# Block buggy release from February 11, 2025
2930
dotnet-version: |
30-
8.0.x
31-
9.0.x
31+
8.0.309
32+
9.0.103
3233
- name: Git checkout
3334
uses: actions/checkout@v4
3435
- name: Initialize CodeQL

docs/build-dev.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ if (-Not $NoBuild -Or -Not (Test-Path -Path _site)) {
4040
dotnet tool restore
4141
VerifySuccessExitCode
4242

43-
dotnet docfx ./docfx.json
43+
dotnet docfx ./docfx.json --warningsAsErrors true
4444
VerifySuccessExitCode
4545

4646
Copy-Item -Force home/*.html _site/

docs/docfx.json

+62-48
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,67 @@
11
{
2-
"metadata": [
2+
"metadata": [
3+
{
4+
"properties": {
5+
"ProduceReferenceAssembly": "true"
6+
},
7+
"src": [
38
{
4-
"src": [
5-
{
6-
"files": [ "**/JsonApiDotNetCore.csproj","**/JsonApiDotNetCore.Annotations.csproj" ],
7-
"src": "../"
8-
}
9-
],
10-
"dest": "api",
11-
"disableGitFeatures": false
9+
"files": [
10+
"**/JsonApiDotNetCore.csproj",
11+
"**/JsonApiDotNetCore.Annotations.csproj"
12+
],
13+
"src": "../"
1214
}
13-
],
14-
"build": {
15-
"content": [
16-
{
17-
"files": [
18-
"api/**.yml",
19-
"api/index.md",
20-
"getting-started/**.md",
21-
"getting-started/**/toc.yml",
22-
"usage/**.md",
23-
"request-examples/**.md",
24-
"internals/**.md",
25-
"toc.yml",
26-
"*.md"
27-
],
28-
"exclude": [
29-
"**/README.md"
30-
]
31-
}
32-
],
33-
"resource": [
34-
{
35-
"files": [ "diagrams/*.svg" ]
36-
}
37-
],
38-
"overwrite": [
39-
{
40-
"exclude": [ "obj/**", "_site/**" ]
41-
}
42-
],
43-
"dest": "_site",
44-
"globalMetadataFiles": [],
45-
"fileMetadataFiles": [],
46-
"template": [ "default", "modern" ],
47-
"postProcessors": [],
48-
"noLangKeyword": false,
49-
"keepFileLink": false,
50-
"cleanupCacheHistory": false,
51-
"disableGitFeatures": false
15+
],
16+
"dest": "api",
17+
"disableGitFeatures": false
5218
}
19+
],
20+
"build": {
21+
"content": [
22+
{
23+
"files": [
24+
"api/**.yml",
25+
"api/index.md",
26+
"getting-started/**.md",
27+
"getting-started/**/toc.yml",
28+
"usage/**.md",
29+
"request-examples/**.md",
30+
"internals/**.md",
31+
"toc.yml",
32+
"*.md"
33+
],
34+
"exclude": [
35+
"**/README.md"
36+
]
37+
}
38+
],
39+
"resource": [
40+
{
41+
"files": [
42+
"diagrams/*.svg"
43+
]
44+
}
45+
],
46+
"overwrite": [
47+
{
48+
"exclude": [
49+
"obj/**",
50+
"_site/**"
51+
]
52+
}
53+
],
54+
"dest": "_site",
55+
"globalMetadataFiles": [],
56+
"fileMetadataFiles": [],
57+
"template": [
58+
"default",
59+
"modern"
60+
],
61+
"postProcessors": [],
62+
"noLangKeyword": false,
63+
"keepFileLink": false,
64+
"cleanupCacheHistory": false,
65+
"disableGitFeatures": false
66+
}
5367
}

docs/usage/common-pitfalls.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Did you notice the missing type of the `LoginAccount.Customer` property? We must
5050
This is only one of the issues you'll run into. Just don't go there.
5151

5252
The right way to model this is by having only `Customer` instead of `WebCustomer` and `AdminCustomer`. And then:
53-
- Hide the `CreditRating` property for web users using [this](https://www.jsonapi.net/usage/extensibility/resource-definitions.html#excluding-fields) approach.
53+
- Hide the `CreditRating` property for web users using [this](~/usage/extensibility/resource-definitions.md#excluding-fields) approach.
5454
- Block web users from setting the `CreditRating` property from POST/PATCH resource endpoints by either:
5555
- Detecting if the `CreditRating` property has changed, such as done [here](https://github.com/json-api-dotnet/JsonApiDotNetCore/blob/master/test/JsonApiDotNetCoreTests/IntegrationTests/InputValidation/RequestBody/WorkflowDefinition.cs).
5656
- Injecting `ITargetedFields`, throwing an error when it contains the `CreditRating` property.
@@ -87,6 +87,11 @@ Neither sounds very compelling. If stored procedures is what you need, you're be
8787
Although recommended by Microsoft for hard-written controllers, the opinionated behavior of [`[ApiController]`](https://learn.microsoft.com/en-us/aspnet/core/web-api/?view=aspnetcore-7.0#apicontroller-attribute) violates the JSON:API specification.
8888
Despite JsonApiDotNetCore trying its best to deal with it, the experience won't be as good as leaving it out.
8989

90+
#### Don't use auto-generated controllers with shared models
91+
92+
When model classes are defined in a separate project, the controllers are generated in that project as well, which is probably not what you want.
93+
For details, see [here](~/usage/extensibility/controllers.md#auto-generated-controllers).
94+
9095
#### Register/override injectable services
9196
Register your JSON:API resource services, resource definitions and repositories with `services.AddResourceService/AddResourceDefinition/AddResourceRepository()` instead of `services.AddScoped()`.
9297
When using [Auto-discovery](~/usage/resource-graph.md#auto-discovery), you don't need to register these at all.

package-versions.props

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
<NSwagApiClientVersion>14.2.*</NSwagApiClientVersion>
2424
<NewtonsoftJsonVersion>13.0.*</NewtonsoftJsonVersion>
2525
<ScalarAspNetCoreVersion>1.2.*</ScalarAspNetCoreVersion>
26-
<SourceLinkVersion>8.0.*</SourceLinkVersion>
2726
<SwashbuckleVersion>7.*-*</SwashbuckleVersion>
2827
<SystemTextJsonVersion>9.0.*</SystemTextJsonVersion>
2928
<TestSdkVersion>17.12.*</TestSdkVersion>

src/JsonApiDotNetCore.Annotations/JsonApiDotNetCore.Annotations.csproj

-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
<PackageIcon>package-icon.png</PackageIcon>
2121
<PackageReadmeFile>PackageReadme.md</PackageReadmeFile>
2222
<PublishRepositoryUrl>true</PublishRepositoryUrl>
23-
<EmbedUntrackedSources>true</EmbedUntrackedSources>
2423
<DebugType>embedded</DebugType>
2524
</PropertyGroup>
2625

@@ -47,7 +46,6 @@
4746
</ItemGroup>
4847

4948
<ItemGroup>
50-
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="$(SourceLinkVersion)" PrivateAssets="All" />
5149
<PackageReference Include="SauceControl.InheritDoc" Version="$(InheritDocVersion)" PrivateAssets="All" />
5250
</ItemGroup>
5351
</Project>

src/JsonApiDotNetCore.OpenApi.Client.Kiota/JsonApiDotNetCore.OpenApi.Client.Kiota.csproj

-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
<PackageIcon>package-icon.png</PackageIcon>
2222
<PackageReadmeFile>PackageReadme.md</PackageReadmeFile>
2323
<PublishRepositoryUrl>true</PublishRepositoryUrl>
24-
<EmbedUntrackedSources>true</EmbedUntrackedSources>
2524
<DebugType>embedded</DebugType>
2625
</PropertyGroup>
2726

@@ -39,7 +38,6 @@
3938
</ItemGroup>
4039

4140
<ItemGroup>
42-
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="$(SourceLinkVersion)" PrivateAssets="All" />
4341
<PackageReference Include="SauceControl.InheritDoc" Version="$(InheritDocVersion)" PrivateAssets="All" />
4442
</ItemGroup>
4543
</Project>

src/JsonApiDotNetCore.OpenApi.Client.NSwag/JsonApiDotNetCore.OpenApi.Client.NSwag.csproj

-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
<PackageIcon>package-icon.png</PackageIcon>
2121
<PackageReadmeFile>PackageReadme.md</PackageReadmeFile>
2222
<PublishRepositoryUrl>true</PublishRepositoryUrl>
23-
<EmbedUntrackedSources>true</EmbedUntrackedSources>
2423
<DebugType>embedded</DebugType>
2524
</PropertyGroup>
2625

@@ -31,7 +30,6 @@
3130
</ItemGroup>
3231

3332
<ItemGroup>
34-
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="$(SourceLinkVersion)" PrivateAssets="All" />
3533
<PackageReference Include="Newtonsoft.Json" Version="$(NewtonsoftJsonFrozenVersion)" />
3634
<PackageReference Include="SauceControl.InheritDoc" Version="$(InheritDocVersion)" PrivateAssets="All" />
3735
</ItemGroup>

src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiDotNetCore.OpenApi.Swashbuckle.csproj

-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
<PackageIcon>package-icon.png</PackageIcon>
2121
<PackageReadmeFile>PackageReadme.md</PackageReadmeFile>
2222
<PublishRepositoryUrl>true</PublishRepositoryUrl>
23-
<EmbedUntrackedSources>true</EmbedUntrackedSources>
2423
<DebugType>embedded</DebugType>
2524
</PropertyGroup>
2625

@@ -34,7 +33,6 @@
3433
</ItemGroup>
3534

3635
<ItemGroup>
37-
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="$(SourceLinkVersion)" PrivateAssets="All" />
3836
<PackageReference Include="SauceControl.InheritDoc" Version="$(InheritDocVersion)" PrivateAssets="All" />
3937
<PackageReference Include="Swashbuckle.AspNetCore" Version="$(SwashbuckleFrozenVersion)" />
4038
</ItemGroup>

src/JsonApiDotNetCore/JsonApiDotNetCore.csproj

-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
<PackageIcon>package-icon.png</PackageIcon>
2020
<PackageReadmeFile>PackageReadme.md</PackageReadmeFile>
2121
<PublishRepositoryUrl>true</PublishRepositoryUrl>
22-
<EmbedUntrackedSources>true</EmbedUntrackedSources>
2322
<DebugType>embedded</DebugType>
2423
</PropertyGroup>
2524

@@ -42,7 +41,6 @@
4241
<PackageReference Include="Humanizer.Core" Version="$(HumanizerFrozenVersion)" />
4342
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="$(EntityFrameworkCoreFrozenVersion)" />
4443
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="$(EntityFrameworkCoreFrozenVersion)" />
45-
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="$(SourceLinkVersion)" PrivateAssets="All" />
4644
<PackageReference Include="SauceControl.InheritDoc" Version="$(InheritDocVersion)" PrivateAssets="All" />
4745
</ItemGroup>
4846
</Project>

0 commit comments

Comments
 (0)