You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/CONTRIBUTING.md
+44Lines changed: 44 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -67,6 +67,50 @@ have a chance of keeping on top of things:
67
67
11. Together with your reviewer, polish your changes until they are ready to be
68
68
merged.
69
69
70
+
## API Documentation with Swagger
71
+
72
+
Controllers are annotated with the [`OpenAPI`](https://swagger.io/docs/specification/about/) specification using the `PHPDoc` implementation from [zircote/swagger-php](https://github.com/zircote/swagger-php).
73
+
74
+
If you add or modify existing annotations, you should run `composer generate-openapi` to have the updated version of the API Docs.
75
+
76
+
77
+
### Details on `composer generate-openapi`
78
+
79
+
`composer generate-openapi` basically runs `vendor/bin/openapi -o docs/swagger/openapi.json --format json src"` defined in the scripts section of `composer.json` which inturn generates the `OpenAPI` specification file `openapi.json` in the `docs/swagger` directory and then copies the documentation and `swagger-ui` files to `public/docs`.
80
+
81
+
82
+
### Swagger UI
83
+
84
+
[Swagger UI](https://github.com/swagger-api/swagger-ui) is used to visualize generated `OpenAPI` documentation and is served at `{root-url}/docs` for example `localhost:8000/docs`.
85
+
86
+
#### Updating Swagger UI
87
+
88
+
We use`swagger-ui-dist` which is the compiled version of swagger UI for server side projects. It's simply a copy of the `dist` directory from the[Swagger UI Repo](https://github.com/swagger-api/swagger-ui)) stored `public/docs`.
89
+
90
+
So if there are updates in the UI we would like to have, the fastest way to update our copy of swagger UI would be to clone the entire swagger UI [repository](https://github.com/swagger-api/swagger-ui) and copy the contents of `dist` to `public/docs` and make the required changes to `public/docs/index.html`. That includes making sure the assets (javascript and css) are pointing to the right place (`/docs/`) and that `SwaggerUIBundle` is referencing `public/docs/openapi.json` correctly as shown bellow;
Copy file name to clipboardExpand all lines: README.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,6 +36,12 @@ Please install this package via Composer from within the
36
36
[phpList base distribution](https://github.com/phpList/base-distribution),
37
37
which also has more detailed installation instructions in the README.
38
38
39
+
## API Documentation
40
+
41
+
Visit `/docs` endpoint to access the full interactive documentation for `phpList/rest-api`.
42
+
43
+
Look at the **"API Documentation with Swagger"** section in the [contribution guide](.github/CONTRIBUTING.md) for more information on API documenation.
44
+
39
45
## Local demo with Postman
40
46
41
47
You can try out the API using pre-prepared requests and the Postman GUI
0 commit comments