mirror of https://github.com/tiangolo/fastapi.git
📝 Update DocInfo to not be a dataclass, Jelle's feedback, avoid bootstrapping problems, make it hashable
This commit is contained in:
parent
c1616eb92f
commit
e3360367f7
|
|
@ -89,12 +89,9 @@ def create_user(
|
||||||
The return of the `doc()` function is an instance of a class that can be checked and used at runtime, defined as:
|
The return of the `doc()` function is an instance of a class that can be checked and used at runtime, defined as:
|
||||||
|
|
||||||
```Python
|
```Python
|
||||||
from dataclasses import dataclass
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
|
||||||
class DocInfo:
|
class DocInfo:
|
||||||
documentation: str
|
def __init__(self, documentation: str):
|
||||||
|
self.documentation = documentation
|
||||||
```
|
```
|
||||||
|
|
||||||
where the attribute `documentation` contains the same value string passed to the function `doc()`.
|
where the attribute `documentation` contains the same value string passed to the function `doc()`.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue