-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No way to add description to path parameters #23
Comments
This is similar to #19 as both examples and descriptions are treated similarly. Easy way, add metadata to the field: name = fields.String(description='User name', example='Philip J. Fry') If you need to specify those descriptions using |
That's assuming you're using |
I did see your changes there, but it looks like it's fixing a slightly different issue. I'm concerned with path parameters here, not schema arguments. The problem is that currently |
Hmm... I see.
I wonder if we could provide a more declarative way of passing those metadata. Out of my head: Allow a specific syntax for rules to pass parameters description and examples. Parse this in
This sounds much too hackish. Or just use In both cases, this info could be added to the doc in
|
Well, for what it's worth, here congenica-andrew@fe427b1 is what I have already. |
Personally I don't really like the look of trying to add extra stuff into the route definition. How about a new decorator, something like @path_descriptions(thing_id="The ID of the thing") I've not got my head enough around how the library works to work out where this would go though. |
I applied a variation of your fix in master. Would you like to test before I release? Keeping this open for now as the fix does not address the part about passing manual parameter docs without |
So matching name only is not enough. I modified the code to match location and name. |
Sorry, I've not been able to look at this for a couple of days, but I've just tested 0.11.1 from PyPi and it works as expected. The only issue I had is that initially I didn't add the Thanks for the quick fix for this though 🥇 |
Good. I think my rationale here was that:
Ultimately, I'd rather have a nicer way of passing path params doc. I would have liked to avoid yet another decorator, but I'm afraid this is the least awkward solution identified for now. |
We could extend the issue to other parameters (not only path parameters). Adding extra doc to parameters using @doc(parameters=...) won't work because parameters is a list and can't be deepupdated. Not a big deal because auto doc is quite complete already so this shouldn't happen. But it might be good to have that use case in mind when working on a new decorator. |
Path parameters apply to the whole route, not a function (get, post,...). Their documentation could (should?) be added through the Let's follow marshmallow-code/apispec#453 and see if we can rework the |
@congenica-andrew if you're still interested by this, you may want to take a look at #78. |
I can't see any way to add a description to a path parameter. Using the
@blp.doc
decorator as in:just results in adding another parameter with a duplicate name and only a description. I have a local fix for this in
FlaskPlugin
where I just scan the existing parameters and update rather than append if I find one with the same name. I can get this into a PR unless you have another way you'd rather approach this?The text was updated successfully, but these errors were encountered: