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
+32-2Lines changed: 32 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -60,13 +60,43 @@ have a chance of keeping on top of things:
60
60
8. Add a changelog entry.
61
61
9.[Commit](#git-commits) and push your changes.
62
62
10.[Create a pull request](https://help.github.com/articles/about-pull-requests/)
63
-
for your changes. Check that the Travis build is green. (If it is not, fix the
64
-
problems listed by Travis.)
63
+
for your changes. Check that the [Github actions](https://github.com/phpList/rest-api/actions/workflows/ci.yml) build is green. (If it is not, fix the
64
+
problems listed by [Github actions](https://github.com/phpList/rest-api/actions/workflows/ci.yml).)
65
65
We have provided a template for pull requests as well.
66
66
11.[Request a review](https://help.github.com/articles/about-pull-request-reviews/).
67
67
11. Together with your reviewer, polish your changes until they are ready to be
68
68
merged.
69
69
70
+
## API Documenting with `OPENAPI`
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 openapi-generate` to have the updated openapi decription of the API.
75
+
76
+
### Notes
77
+
-`composer openapi-generate` produces `openapi.json` in `docs/`
78
+
- The generated `docs/openapi.json` is excluded in commits. _See .gitignore_
79
+
- The only reason you should generate `openapi.json` is for debugging and testing.
80
+
81
+
### Debugging `openapi.json` description.
82
+
83
+
To ensure builds pass and new annotations are deployed, do validate `openapi.json` by copy-pasting it's content in `https://validator.swagger.io/`
84
+
85
+
In addition you can also use the [openapi-checker](github.com/phplist/openapi-checker) to validate you file as follows;
86
+
87
+
-`npm install -g openapi-checker`
88
+
-`openapi-checker docs/openapi.json`
89
+
90
+
### More on `composer openapi-generate`
91
+
92
+
`composer openapi-generate` basically runs `vendor/bin/openapi -o docs/openapi.json --format json src` defined in the scripts section of `composer.json` which as mentioned above generates `openapi.json` description file in the `docs/` directory.
93
+
94
+
### Swagger UI
95
+
96
+
[Swagger UI](https://github.com/swagger-api/swagger-ui) is used to visualize generated api description and is visible at [phplist.github.io/restapi-docs](https://phplist.github.io/restapi-docs) after a successful CI build.
97
+
98
+
You might also achieve local visualization by cloning [phplist/restapi-docs](https://github.com/phpList/restapi-docs) and temporally changing the `url` property of `SwaggerUIBundle` to point to your generated file.
Copy file name to clipboardExpand all lines: README.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,6 +40,8 @@ which also has more detailed installation instructions in the README.
40
40
41
41
Visit `/docs` endpoint to access the full interactive documentation for `phpList/rest-api`.
42
42
43
+
Look at the **"API Documentation with Swagger"** section in the [contribution guide](.github/CONTRIBUTING.md) for more information on API documenation.
44
+
43
45
## Local demo with Postman
44
46
45
47
You can try out the API using pre-prepared requests and the Postman GUI
0 commit comments