domaindrivendev/Swashbuckle.AspNetCore

[Bug]: The annotation of the field parameter using FromForm in the interface is not displayed

Closed this issue · 21 comments

What are you wanting to achieve?

The annotation of the field parameter using FromForm in the interface is not displayed

image

What code or approach do you have so far?

no

Additional context

No response

Sorry, I don't understand what you're trying to explain is broken here.

/// <summary> /// 修改密码 /// </summary> /// <param name="OldPassword">旧密码</param> /// <param name="NewPassword">新密码</param> /// <param name="ComfimPassword">确认密码</param> /// <returns></returns> [HttpPost("ChangePassword")] [ApiSignature] public IActionResult ChangePassword([FromForm)] string OldPassword, [FromForm] string NewPassword, [FromForm] string ComfimPassword)
image

image

@martincostello

So you're expecting the XML documentation for those parameters to be present as the description on the parameters in the OpenAPI specification?

How are you configuring XML documents to be added to the OpenAPI document? Do they appear in other places you'd expect them to be?

So you're expecting the XML documentation for those parameters to be present as the description on the parameters in the OpenAPI specification?
yes

Do they appear in other places you'd expect them to be?
no

The old version was OK, but not after the upgrade.

The old version was OK, but not after the upgrade.

From which version to which version?

ApiDemo.zip
I just created a new project casually, and then tested it and found the same problem, you can take a look.
@martincostello

image
image
At present, the test found that the request Body comment is not displayed when the parameter uses FromForm. If you use DTO, the object can be displayed normally

@martincostello Can you Help me?

This is a bug - it has never worked.

Also, FWIW, your repo is using Swashbuckle.AspNetCore 6.4.0 which is 2 years old. If you experience an issue, please try the latest version before reporting an issue in case it has since been fixed.

There is the same problem, and it should be possible to use versions before 6.
image

Yes, I already tried it with the latest version before I posted the comment.

We don't be back-porting any fixes to old versions of Swashbuckle like v5. The fix will be in future versions only.

When will 6.7.1 be released, we want to use it as soon as possible

I don't know exactly when. It depends on when other contributors review and approve the PRs open against that milestone.

Okay, thank you so much for your support

Re-opening it as it's an active issue (that others can find more easily) until the fix is shipped.

Version 6.7.1 is now available from NuGet.org which resolves this issue.

@martincostello So far, only the first parameter has been described, but the others are not

That is a different issue: #2062

The first form parameter is being used to describe the request body as a whole (which on reflection is probably incorrect if there are multiple properties, which is another issue caused by the fix for this issue: #3038).

Separately, the members of the request are not being documented at all, which is the issue above.