[FEATURE] Descriptive representational strings for params
See original GitHub issueIs your feature request related to a problem
Kind of, recently I generated a documentation for one of my personal projects using mkdocstrings and that’s how it renders params:
That’s the behavior I would prefer:
The solution you would like
Implement __repr__
for all classes in fastapi.params
.
I am willing to do that, but first I wanted to make sure that this is a good idea and such PR would be accepted.
Describe alternatives you’ve considered
A dirty hack like this:
from fastapi.params import Depends as Dep
class Depends(Dep):
def __init__(self, dependency = None, *, use_cache=True):
super().__init__(dependency, use_cache=True)
def __repr__(self) -> str:
name = getattr(self.dependency, "__name__", type(self.dependency).__name__)
args = name
if not self.use_cache:
args += ", use_cache=False"
return f"Depends({args})"
Works, but it would be nice to have it by default.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:7 (5 by maintainers)
Top Results From Across the Web
String functions for Bicep - Azure Resource Manager
Returns the base64 representation of the input string. Namespace: sys. Parameters. Parameter, Required, Type, Description. inputString, Yes ...
Read more >REST API Best Practices for Parameter and Query String Usage
How to use Query String Parameters? Array and Map Parameters; When Should the Query String not be Used? Introduction. Representational State ...
Read more >class StringParameter (construct) · AWS CDK
Returns a string representation of this construct. static fromSecureStringParameterAttributes(scope, id, attrs), Imports a secure string parameter from the SSM ...
Read more >Parameter Sets - PBR Book
Most of pbrt's API routines take a ParamSet as one of their parameters; ... of parameters to any function, so a more time-efficient...
Read more >String-Based Feature Representation for Trajectory Clustering
A string-based model is used, where trajectories are represented as strings and string-based distance metrics are used to measure the similarity between ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yep, there’s no PR with this yet, so if @victorphoenix3 or @rkbeatss are ready, go ahead! 🚀 🤓
I think this would be a good issue for @victorphoenix3 and @rkbeatss to work on - I don’t want to “steal” it out from under @fabrizzioalco if he’s already started, though.