Skip to content

Commit 52016b5

Browse files
author
Bart Koelman
authored
Merge pull request #823 from bart-degreed/docs-attr
Corrections in documentation after public API changes from #808
2 parents 938985f + b45fb2e commit 52016b5

File tree

6 files changed

+15
-15
lines changed

6 files changed

+15
-15
lines changed

docs/getting-started/step-by-step.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ The easiest way to do this is to inherit from `Identifiable`
4040
```c#
4141
public class Person : Identifiable
4242
{
43-
[Attr("name")]
43+
[Attr]
4444
public string Name { get; set; }
4545
}
4646
```
@@ -61,7 +61,7 @@ public class AppDbContext : DbContext
6161

6262
### Define Controllers
6363

64-
You need to create controllers that inherit from `JsonApiController<T>` or `JsonApiController<T, TId>`
64+
You need to create controllers that inherit from `JsonApiController<TResource>` or `JsonApiController<TResource, TId>`
6565
where `T` is the model that inherits from `Identifiable<TId>`
6666

6767
```c#

docs/usage/extensibility/controllers.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Controllers
22

3-
You need to create controllers that inherit from `JsonApiController<T>`
3+
You need to create controllers that inherit from `JsonApiController<TResource>`
44

55
```c#
66
public class ArticlesController : JsonApiController<Article>

docs/usage/extensibility/services.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ public class TodoItemService : JsonApiResourceService<TodoItem>
2121
IPaginationContext paginationContext,
2222
IJsonApiOptions options,
2323
ILoggerFactory loggerFactory,
24-
ICurrentRequest currentRequest,
24+
IJsonApiRequest request,
2525
IResourceChangeTracker<TResource> resourceChangeTracker,
2626
IResourceFactory resourceFactory,
2727
IResourceHookExecutor hookExecutor = null)
28-
: base(repository, queryLayerComposer, paginationContext, options, loggerFactory, currentRequest,
28+
: base(repository, queryLayerComposer, paginationContext, options, loggerFactory, request,
2929
resourceChangeTracker, resourceFactory, hookExecutor)
3030
{
3131
_notificationService = notificationService;
@@ -47,7 +47,7 @@ public class TodoItemService : JsonApiResourceService<TodoItem>
4747
## Not Using Entity Framework Core?
4848

4949
As previously discussed, this library uses Entity Framework Core by default.
50-
If you'd like to use another ORM that does not provide what JsonApiResourceService depends upon, you can use a custom `IResourceService<T>` implementation.
50+
If you'd like to use another ORM that does not provide what JsonApiResourceService depends upon, you can use a custom `IResourceService<TResource>` implementation.
5151

5252
```c#
5353
// Startup.cs

docs/usage/resources/attributes.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ There are two ways the public attribute name is determined:
2121
```c#
2222
public class Person : Identifiable
2323
{
24-
[Attr("first-name")]
24+
[Attr(PublicName = "first-name")]
2525
public string FirstName { get; set; }
2626
}
2727
```
@@ -45,7 +45,7 @@ Attributes can be marked to allow returning their value in responses. When not a
4545
```c#
4646
public class User : Identifiable<int>
4747
{
48-
[Attr(~AttrCapabilities.AllowView)]
48+
[Attr(Capabilities = ~AttrCapabilities.AllowView)]
4949
public string Password { get; set; }
5050
}
5151
```
@@ -57,7 +57,7 @@ Attributes can be marked as mutable, which will allow `PATCH` requests to update
5757
```c#
5858
public class Person : Identifiable<int>
5959
{
60-
[Attr(AttrCapabilities.AllowMutate)]
60+
[Attr(Capabilities = AttrCapabilities.AllowChange)]
6161
public string FirstName { get; set; }
6262
}
6363
```
@@ -69,7 +69,7 @@ Attributes can be marked to allow filtering and/or sorting. When not allowed, it
6969
```c#
7070
public class Person : Identifiable<int>
7171
{
72-
[Attr(AttrCapabilities.AllowSort | AttrCapabilities.AllowFilter)]
72+
[Attr(Capabilities = AttrCapabilities.AllowSort | AttrCapabilities.AllowFilter)]
7373
public string FirstName { get; set; }
7474
}
7575
```

docs/usage/resources/relationships.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ For example, a TodoItem may have an Owner and so the Id attribute should be Owne
1111
```c#
1212
public class TodoItem : Identifiable<int>
1313
{
14-
[Attr("description")]
14+
[Attr]
1515
public string Description { get; set; }
1616

17-
[HasOne("owner")]
17+
[HasOne]
1818
public Person Owner { get; set; }
1919
public int OwnerId { get; set; }
2020
}
@@ -28,10 +28,10 @@ the @JsonApiDotNetCore.Configuration.JsonApiOptions#JsonApiDotNetCore_Configurat
2828
```c#
2929
public class Person : Identifiable<int>
3030
{
31-
[Attr("first-name")]
31+
[Attr(PublicName = "first-name")]
3232
public string FirstName { get; set; }
3333

34-
[HasMany("todo-items")]
34+
[HasMany(PublicName = "todo-items")]
3535
public ICollection<TodoItem> TodoItems { get; set; }
3636
}
3737
```

docs/usage/resources/resource-definitions.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ from Entity Framework Core `IQueryable` execution.
2121
There are some cases where you want attributes conditionally excluded from your resource response.
2222
For example, you may accept some sensitive data that should only be exposed to administrators after creation.
2323

24-
Note: to exclude attributes unconditionally, use `Attr[~AttrCapabilities.AllowView]`.
24+
Note: to exclude attributes unconditionally, use `[Attr(Capabilities = ~AttrCapabilities.AllowView)]`.
2525

2626
```c#
2727
public class UserDefinition : ResourceDefinition<User>

0 commit comments

Comments
 (0)