33## Development
44
55``` bash
6- docker compose pull
6+ docker compose pull
77docker compose up --detach
88docker compose exec phpfpm composer install
99docker compose run --rm node npm install
@@ -25,15 +25,46 @@ The fixtures have the image-text template, and two screen layouts: full screen a
2525
2626TODO
2727
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.
2960
3061## Tests
3162
3263### API tests
3364
3465TODO
3566
36- ### Admin / Client tests
67+ ### Admin and Client tests
3768
3869To run tests, use the script:
3970
0 commit comments