Skip to content

Commit

Permalink
Swagger added in docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Bishwas-py committed Feb 26, 2024
1 parent 3499bfb commit a1ec74e
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 1 deletion.
Binary file removed docs/img.png
Binary file not shown.
33 changes: 32 additions & 1 deletion docs/swagger.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ It is flawless, it is perfect, it is beautiful.

Here's how it looks like:

![img.png](img.png)
![Djapy Swagger Support](swagger_screenshot.png)

And here's how you can use it:

Expand All @@ -26,3 +26,34 @@ urlpatterns = [
```

And that's it. You can now access your swagger documentation at the url you've set in your `urls.py` file.

## Tags and descriptions

You can add tags and descriptions to your endpoints by using the `openapi_info` variable.

```python
openapi_info = {
"tags": ["todos"],
"tags_info": {
"todos": {
"description": "Operations about todos",
"name": "Todos",
"externalDocs": {
"description": "Find out more",
"url": "http://example.com"
}
}
}
}
```

Also, you can assign tags name using `@djapigy` decorator.

```python
from djapy import djapigy


@djapify(openapi_tags=["todos"])
```

It's that simple.
Binary file added docs/swagger_screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,4 @@ copyright: |
nav:
- Introduction: index.md
- Usage: usage.md
- Swagger: swagger.md

0 comments on commit a1ec74e

Please sign in to comment.