]> git.ipfire.org Git - thirdparty/fastapi/fastapi.git/commitdiff
📝 Add **kwargs parameter to follow the design in the final version of dataclass_transform
authorSebastián Ramírez <tiangolo@gmail.com>
Mon, 5 Dec 2022 19:58:17 +0000 (20:58 +0100)
committerSebastián Ramírez <tiangolo@gmail.com>
Mon, 5 Dec 2022 19:58:17 +0000 (20:58 +0100)
typing_doc.md

index 0dcdb1c062a6dbdbff709b5ee8e345421be9d1af..a92a0a76f22e841bfd38a5437ef961166923c269 100644 (file)
@@ -42,6 +42,7 @@ This `doc()` function would receive several parameters for metadata and document
 * `discouraged: bool`: this would mark a parameter, class, function, or method as discouraged. Editors could display them similar to `deprecated`. The reason why having a `discouraged` apart from `deprecated` is that there are cases where something is not gonna be removed for backward compatibility, but it shouldn't be used in new code. An example of this is `datetime.utcnow()`.
 * `extra: dict`: a dictionary containing any additional metadata that could be useful for developers or library authors.
     * An `extra` parameter instead of `**kwargs` is proposed to allow adding future standard parameters.
+* `**kwargs: Any`: allows arbitrary additional keyword args. This gives type checkers the freedom to support experimental parameters without needing to wait for changes in `typing.py`. Type checkers should report errors for any unrecognized parameters. This follows the same pattern designed in [PEP 681 – Data Class Transforms](https://peps.python.org/pep-0681/).
 
 Other possible future parameters could include: