Skip to content

Commit

Permalink
docs: update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
dantetemplar authored Jan 10, 2025
1 parent 6200760 commit de54d55
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
on your endpoint's source code.
This plugin helps you reduce boilerplate code by deriving response statuses and descriptions directly from your code.

With `fastapi-derive-responses` you can omit ~5 lines on endpoint definition:
With `fastapi-derive-responses` you can omit ~4 lines on endpoint definition:

```diff
@app.get(
"/add_user",
responses={
- 200: {"description": "User added successfully"},
200: {"description": "User added successfully"},
- 400: {"description": "User already exists"},
- 401: {"description": "Invalid token"},
- 403: {"description": "Only admins and moderators can add users or You are banned"},
Expand Down Expand Up @@ -55,8 +55,7 @@ def add_user(
## Known Issues

Plugin works through AST parsing, so it may not work correctly with complex code structures or runtime generated code.
Also, it may produce false positives: for example, if you raise an exception with name `HTTPException` from another
module (not from `starlette` or `fastapi`) it will be parsed.
Also, it may produce false positives: for example, if you raise an exception with name `HTTPException` yet not from `starlette` or `fastapi` and you have imported `starlette.HTTPException` in the same module but in some isolated scope then your exception will be considered as `starlette.HTTPException`.

## Installation

Expand Down Expand Up @@ -162,4 +161,4 @@ app.router.route_class = AutoDeriveResponsesAPIRoute
def raise_custom_exception():
raise ImportedCustomException(status_code=601, detail="CustomException!")

```
```

0 comments on commit de54d55

Please sign in to comment.