Skip to content

Commit 71b3bd0

Browse files
authored
Update hooks.md
1 parent 08917c7 commit 71b3bd0

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

docs/usage/resources/hooks.md

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
@milosloub @wisepotato.
2+
3+
New hooks API is pretty much finished. Below is the usage guide, can also be found in the docs. Time for a re-review.
4+
5+
Let us focus first on the discussion of the usage / hooks API / backward compatiblity related stuff.
6+
7+
As soon as we're totally aligned with respect to this, we can quibble about internals: at this point any changes internally should not affect the interfaces/hooks API, therefore shouldn't be breaking
8+
9+
110

211
# Resource Hooks
312
This section covers the usage of **Resource Hooks**, which is a feature of`ResourceDefinition<T>`. See the [ResourceDefinition usage guide](resource-definitions.md) for a general explanation on how to set up a `ResourceDefinition<T>`.
@@ -14,14 +23,14 @@ Understanding the semantics will be helpful in identifying which hooks on `Resou
1423
2. [**Hook execution overview**](#hook-execution-overview)
1524
A table overview of all pipelines and involved hooks
1625
3. [**Examples: basic usage**](#examples-basic-usage)
17-
1. [**Most minimal example**](#most-minimal-example)
18-
2. [**Logging**](#logging)
19-
3. [**Transforming data with OnReturn**](#transforming-data-with-onreturn)
26+
* [**Most minimal example**](#most-minimal-example)
27+
* [**Logging**](#logging)
28+
* [**Transforming data with OnReturn**](#transforming-data-with-onreturn)
2029
5. [**Examples: advanced usage**](#examples-advanced-usage)
21-
1. [**Simple authorization: explicitly affected resources**](#simple-authorization-explicitly-affected-resources)
22-
2. [**Advanced authorization: implicitly affected resources**](#advanced-authorization-implicitly-affected-resources)
23-
3. [**Synchronizing data across microservices**](#synchronizing-data-across-microservices)
24-
4. [**Hooks for many-to-many join tables**](#hooks-for-many-to-many-join-tables)
30+
* [**Simple authorization: explicitly affected resources**](#simple-authorization-explicitly-affected-resources)
31+
* [**Advanced authorization: implicitly affected resources**](#advanced-authorization-implicitly-affected-resources)
32+
* [**Synchronizing data across microservices**](#synchronizing-data-across-microservices)
33+
* [**Hooks for many-to-many join tables**](#hooks-for-many-to-many-join-tables)
2534

2635

2736
# 1. Semantics: pipelines, actions and hooks
@@ -34,7 +43,7 @@ The different execution flows within the RSL that may be intercepted can be iden
3443
* **Get**: reading a resource (triggered by the endpoint `GET /my-resource`).
3544
* **GetSingle**: reading a single resource (triggered by the endpoint `GET /my-resource/1`).
3645

37-
See the [ResourcePipeline](www.will-add-link-later.com) enum for a full list of available pipelines.
46+
See the [ResourcePipeline](https://github.com/json-api-dotnet/JsonApiDotNetCore/blob/feat/%23477/src/JsonApiDotNetCore/Hooks/Execution/ResourcePipelineEnum.cs) enum for a full list of available pipelines.
3847

3948
## Actions
4049
Each pipeline is associated with a set of **actions** that work on resources and their relationships. These actions reflect the associated database operations that is performed by JsonApiDotNetCore (in the Repository Layer). Typically, the RSL will execute some service-layer-related code, then invoke the Repository Layer which will perform these actions, after which the execution returns to the RSL.
@@ -88,7 +97,7 @@ As mentioned in the previous section, some actions are shared across hooks. One
8897

8998
Any return content can be intercepted and transformed as desired by implementing the `ResourceDefintion<TEntity>.OnReturn` hook which intercepts the `return` action. For this action, there is no distinction between a `Before` and `After` hook, because no code after a `return` statement can be evaluated. Note that the `return` action can work on *main resources as well as nested resources*, see [this example below](#transforming-data-with-onreturn).
9099
<br><br>
91-
For an overview of all pipelines, hooks and actions, see the table below, and for more detailed information about the available hooks, see the [IResourceHookContainer<T>](www.will-add-link-later.com) interface.
100+
For an overview of all pipelines, hooks and actions, see the table below, and for more detailed information about the available hooks, see the [IResourceHookContainer<T>](https://github.com/json-api-dotnet/JsonApiDotNetCore/blob/ab1f96d8255532461da47d290c5440b9e7e6a4a5/src/JsonApiDotNetCore/Hooks/IResourceHookContainer.cs) interface.
92101

93102
# 2. Hook execution overview
94103

0 commit comments

Comments
 (0)