Skip to content

Commit febe396

Browse files
committed
Use docfx Alerts
1 parent 3b034f4 commit febe396

14 files changed

+51
-30
lines changed

docs/request-examples/index.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ These requests have been generated against the "GettingStarted" application and
44

55
All of these requests have been created using out-of-the-box features.
66

7-
_Note that cURL requires "[" and "]" in URLs to be escaped._
7+
> [!NOTE]
8+
> curl requires "[" and "]" in URLs to be escaped.
89
910
# Reading data
1011

docs/usage/caching.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ ETag: "356075D903B8FE8D9921201A7E7CD3F9"
5959
"data": [ ... ]
6060
}
6161
```
62-
63-
**Note:** To just poll for changes (without fetching them), send a HEAD request instead:
62+
> [!TIP]
63+
> To just poll for changes (without fetching them), send a HEAD request instead.
6464
6565
```http
6666
HEAD /articles?sort=-lastModifiedAt HTTP/1.1

docs/usage/extensibility/layer-overview.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ on your needs, you may want to replace other parts by deriving from the built-in
2323

2424
## Replacing injected services
2525

26-
**Note:** If you're using [auto-discovery](~/usage/resource-graph.md#auto-discovery), then resource services, repositories and resource definitions will be automatically registered for you.
27-
2826
Replacing built-in services is done on a per-resource basis and can be done at startup.
2927
For convenience, extension methods are provided to register layers on all their implemented interfaces.
3028

@@ -37,3 +35,6 @@ builder.Services.AddResourceDefinition<ProductDefinition>();
3735
builder.Services.AddScoped<IResourceFactory, CustomResourceFactory>();
3836
builder.Services.AddScoped<IResponseModelAdapter, CustomResponseModelAdapter>();
3937
```
38+
39+
> [!TIP]
40+
> If you're using [auto-discovery](~/usage/resource-graph.md#auto-discovery), then resource services, repositories and resource definitions will be automatically registered for you.

docs/usage/extensibility/repositories.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,14 @@ builder.Services.AddScoped<IResourceWriteRepository<Article, int>, ArticleReposi
1313
In v4.0 we introduced an extension method that you can use to register a resource repository on all of its JsonApiDotNetCore interfaces.
1414
This is helpful when you implement (a subset of) the resource interfaces and want to register them all in one go.
1515

16-
**Note:** If you're using [auto-discovery](~/usage/resource-graph.md#auto-discovery), this happens automatically.
17-
1816
```c#
1917
// Program.cs
2018
builder.Services.AddResourceRepository<ArticleRepository>();
2119
```
2220

21+
> [!TIP]
22+
> If you're using [auto-discovery](~/usage/resource-graph.md#auto-discovery), then resource services, repositories and resource definitions will be automatically registered for you.
23+
2324
A sample implementation that performs authorization might look like this.
2425

2526
All of the methods in EntityFrameworkCoreRepository will use the `GetAll()` method to get the `DbSet<TResource>`, so this is a good method to apply filters such as user or tenant authorization.

docs/usage/extensibility/resource-definitions.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@ They are resolved from the dependency injection container, so you can inject dep
77

88
In v4.2 we introduced an extension method that you can use to register your resource definition.
99

10-
**Note:** If you're using [auto-discovery](~/usage/resource-graph.md#auto-discovery), this happens automatically.
11-
1210
```c#
1311
// Program.cs
1412
builder.Services.AddResourceDefinition<ArticleDefinition>();
1513
```
1614

17-
**Note:** Prior to the introduction of auto-discovery (in v3), you needed to register the
18-
resource definition on the container yourself:
15+
> [!TIP]
16+
> If you're using [auto-discovery](~/usage/resource-graph.md#auto-discovery), then resource services, repositories and resource definitions will be automatically registered for you.
1917
20-
```c#
21-
builder.Services.AddScoped<ResourceDefinition<Article, int>, ArticleDefinition>();
22-
```
18+
> [!NOTE]
19+
> Prior to the introduction of auto-discovery (in v3), you needed to register the resource definition on the container yourself:
20+
> ```c#
21+
> builder.Services.AddScoped<ResourceDefinition<Article, int>, ArticleDefinition>();
22+
> ```
2323
2424
## Customizing queries
2525
@@ -37,7 +37,8 @@ from Entity Framework Core `IQueryable` execution.
3737
There are some cases where you want attributes or relationships conditionally excluded from your resource response.
3838
For example, you may accept some sensitive data that should only be exposed to administrators after creation.
3939
40-
**Note:** to exclude fields unconditionally, [attribute capabilities](~/usage/resources/attributes.md#capabilities) and [relationship capabilities](~/usage/resources/relationships.md#capabilities) can be used instead.
40+
> [!NOTE]
41+
> To exclude fields unconditionally, [attribute capabilities](~/usage/resources/attributes.md#capabilities) and [relationship capabilities](~/usage/resources/relationships.md#capabilities) can be used instead.
4142
4243
```c#
4344
public class UserDefinition : JsonApiResourceDefinition<User, int>
@@ -218,7 +219,8 @@ _since v3_
218219
You can define additional query string parameters with the LINQ expression that should be used.
219220
If the key is present in a query string, the supplied LINQ expression will be added to the database query.
220221

221-
Note this directly influences the Entity Framework Core `IQueryable`. As opposed to using `OnApplyFilter`, this enables the full range of Entity Framework Core operators.
222+
> [!NOTE]
223+
> This directly influences the Entity Framework Core `IQueryable`. As opposed to using `OnApplyFilter`, this enables the full range of Entity Framework Core operators.
222224
But it only works on primary resource endpoints (for example: /articles, but not on /blogs/1/articles or /blogs?include=articles).
223225

224226
```c#

docs/usage/extensibility/services.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,14 @@ builder.Services.AddScoped<IDeleteService<Article, int>, ArticleService>();
135135
In v3.0 we introduced an extension method that you can use to register a resource service on all of its JsonApiDotNetCore interfaces.
136136
This is helpful when you implement (a subset of) the resource interfaces and want to register them all in one go.
137137

138-
**Note:** If you're using [auto-discovery](~/usage/resource-graph.md#auto-discovery), this happens automatically.
139-
140138
```c#
141139
// Program.cs
142140
builder.Services.AddResourceService<ArticleService>();
143141
```
144142

143+
> [!TIP]
144+
> If you're using [auto-discovery](~/usage/resource-graph.md#auto-discovery), then resource services, repositories and resource definitions will be automatically registered for you.
145+
145146
Then on your model, pass in the set of endpoints to expose (the ones that you've registered services for):
146147

147148
```c#

docs/usage/options.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ options.AllowClientGeneratedIds = true;
2424

2525
The default page size used for all resources can be overridden in options (10 by default). To disable paging, set it to `null`.
2626
The maximum page size and number allowed from client requests can be set too (unconstrained by default).
27-
You can also include the total number of resources in each response. Note that when using this feature, it does add some query overhead since we have to also request the total number of resources.
27+
28+
You can also include the total number of resources in each response.
29+
30+
> [!NOTE]
31+
> Including the total number of resources adds some overhead, because the count is fetched in a separate query.
2832
2933
```c#
3034
options.DefaultPageSize = new PageSize(25);

docs/usage/reading/filtering.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ GET /articles?include=author,tags&filter=equals(author.lastName,'Smith')&filter[
6969

7070
In the above request, the first filter is applied on the collection of articles, while the second one is applied on the nested collection of tags.
7171

72-
Note this does **not** hide articles without any matching tags! Use the `has` function with a filter condition (see below) to accomplish that.
72+
> [!WARNING]
73+
> The request above does **not** hide articles without any matching tags! Use the `has` function with a filter condition (see below) to accomplish that.
7374
7475
Putting it all together, you can build quite complex filters, such as:
7576

docs/usage/reading/sparse-fieldset-selection.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ Example for both top-level and relationship:
3636
GET /articles?include=author&fields[articles]=title,body,author&fields[authors]=name HTTP/1.1
3737
```
3838

39-
Note that in the last example, the `author` relationship is also added to the `articles` fieldset, so that the relationship from article to author is returned.
39+
> [!NOTE]
40+
> In the last example, the `author` relationship is also added to the `articles` fieldset, so that the relationship from article to author is returned.
4041
When omitted, you'll get the included resources returned, but without full resource linkage (as described [here](https://jsonapi.org/examples/#sparse-fieldsets)).
4142

4243
## Overriding

docs/usage/resource-graph.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
The `ResourceGraph` is a map of all the JSON:API resources and their relationships that your API serves.
44
It is built at app startup and available as a singleton through Dependency Injection.
55

6-
**Note:** Prior to v4 this was called the `ContextGraph`.
6+
> [!NOTE]
7+
> Prior to v4, this was called the `ContextGraph`.
78
89
## Constructing The Graph
910

docs/usage/resources/index.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ public class Person : Identifiable<Guid>
88
}
99
```
1010

11-
**Note:** Earlier versions of JsonApiDotNetCore allowed a short-hand notation when `TId` is of type `int`. This was removed in v5.
11+
> [!NOTE]
12+
> Earlier versions of JsonApiDotNetCore allowed a short-hand notation when `TId` is of type `int`. This was removed in v5.
1213
1314
If you need to attach annotations or attributes on the `Id` property, you can override the virtual property.
1415

docs/usage/resources/relationships.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,8 @@ This can be overridden per relationship.
277277
Indicates whether the relationship can be returned in responses. When not allowed and requested using `?fields[]=`, it results in an HTTP 400 response.
278278
Otherwise, the relationship (and its related resources, when included) are silently omitted.
279279

280-
Note that this setting does not affect retrieving the related resources directly.
280+
> [!WARNING]
281+
> This setting does not affect retrieving the related resources directly.
281282
282283
```c#
283284
#nullable enable

docs/usage/writing/creating.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,6 @@ POST /articles?include=owner&fields[people]=firstName HTTP/1.1
7171
}
7272
```
7373

74-
After the resource has been created on the server, it is re-fetched from the database using the specified query string parameters and returned to the client.
74+
> [!NOTE]
75+
> After the resource has been created on the server, it is re-fetched from the database using the specified query string parameters and returned to the client.
76+
> However, the used query string parameters only have an effect when `200 OK` is returned.

docs/usage/writing/updating.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,14 @@ POST /articles HTTP/1.1
2121
This preserves the values of all other unsent attributes and is called a *partial patch*.
2222

2323
When only the attributes that were sent in the request have changed, the server returns `204 No Content`.
24-
But if additional attributes have changed (for example, by a database trigger that refreshes the last-modified date) the server returns `200 OK`, along with all attributes of the updated resource.
24+
But if additional attributes have changed (for example, by a database trigger or [resource definition](~/usage/extensibility/resource-definitions.md) that refreshes the last-modified date) the server returns `200 OK`, along with all attributes of the updated resource.
2525

2626
## Updating resource relationships
2727

2828
Besides its attributes, the relationships of a resource can be changed using a PATCH request too.
29-
Note that all resources being assigned in a relationship must already exist.
29+
30+
> [!NOTE]
31+
> All resources being assigned in a relationship must already exist.
3032
3133
When updating a HasMany relationship, the existing set is replaced by the new set. See below on how to add/remove resources.
3234

@@ -65,7 +67,8 @@ PATCH /articles/1 HTTP/1.1
6567

6668
A HasOne relationship can be cleared by setting `data` to `null`, while a HasMany relationship can be cleared by setting it to an empty array.
6769

68-
By combining the examples above, both attributes and relationships can be updated using a single PATCH request.
70+
> [!TIP]
71+
> By combining the examples above, both attributes and relationships can be updated using a single PATCH request.
6972
7073
## Response body
7174

@@ -79,8 +82,9 @@ PATCH /articles/1?include=owner&fields[people]=firstName HTTP/1.1
7982
}
8083
```
8184

82-
After the resource has been updated on the server, it is re-fetched from the database using the specified query string parameters and returned to the client.
83-
Note this only has an effect when `200 OK` is returned.
85+
> [!NOTE]
86+
> After the resource has been updated on the server, it is re-fetched from the database using the specified query string parameters and returned to the client.
87+
> However, the used query string parameters only have an effect when `200 OK` is returned.
8488
8589
# Updating relationships
8690

0 commit comments

Comments
 (0)