3
3
## Development
4
4
5
5
``` bash
6
- docker compose pull
6
+ docker compose pull
7
7
docker compose up --detach
8
8
docker compose exec phpfpm composer install
9
9
docker compose run --rm node npm install
@@ -25,15 +25,46 @@ The fixtures have the image-text template, and two screen layouts: full screen a
25
25
26
26
TODO
27
27
28
- ## Documentation
28
+ ## API specification and generated code
29
+
30
+ When the API is changed a new OpenAPI specification should be generated that reflects the changes to the API.
31
+
32
+ To generate the updated API specification, run the following command:
33
+
34
+ ``` shell
35
+ docker compose exec phpfpm composer update-api-spec
36
+ ```
37
+
38
+ This will generate ` public/api-spec-v2.json ` and ` public/api-spec-v2.yaml ` .
39
+
40
+ This generated API specification is used to generate
41
+ [ Redux Toolkit RTK Query] ( https://redux-toolkit.js.org/rtk-query/overview ) code for interacting with the API.
42
+
43
+ To generate the Redux Toolkit RTK Query code, run the following command:
44
+
45
+ ``` shell
46
+ docker compose exec node npx @rtk-query/codegen-openapi /app/assets/shared/redux/openapi-config.js
47
+ ```
48
+
49
+ This will generate ` assets/shared/redux/generated-api.ts ` . This generated code is enhanced by the custom file
50
+ ` assets/shared/redux/enhanced-api.ts ` .
51
+
52
+ ### Important
53
+
54
+ If new endpoints are added to the API, ` assets/shared/redux/enhanced-api.ts ` should be modified to reflect changes in
55
+ Redux-Toolkit cache invalidation and new hooks should be added.
56
+
57
+ See
58
+ [ https://redux-toolkit.js.org/rtk-query/usage/code-generation ] ( https://redux-toolkit.js.org/rtk-query/usage/code-generation )
59
+ for information about the code generation.
29
60
30
61
## Tests
31
62
32
63
### API tests
33
64
34
65
TODO
35
66
36
- ### Admin / Client tests
67
+ ### Admin and Client tests
37
68
38
69
To run tests, use the script:
39
70
0 commit comments