Skip to content
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

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

Closed
qcjxberin opened this issue Aug 9, 2024 · 21 comments · Fixed by #3020
Assignees
Labels
Milestone

Comments

@qcjxberin
Copy link

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

@martincostello
Copy link
Collaborator

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

@qcjxberin
Copy link
Author

qcjxberin commented Aug 9, 2024

/// <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

@martincostello
Copy link
Collaborator

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?

@qcjxberin
Copy link
Author

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.

@martincostello
Copy link
Collaborator

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

From which version to which version?

@qcjxberin
Copy link
Author

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

@qcjxberin
Copy link
Author

image
image

@qcjxberin
Copy link
Author

qcjxberin commented Aug 10, 2024

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

@qcjxberin
Copy link
Author

@martincostello Can you Help me?

@martincostello martincostello changed the title [Question]: The annotation of the field parameter using FromForm in the interface is not displayed [Bug]: The annotation of the field parameter using FromForm in the interface is not displayed Aug 12, 2024
@martincostello martincostello self-assigned this Aug 12, 2024
@martincostello martincostello added this to the v6.7.1 milestone Aug 12, 2024
@martincostello
Copy link
Collaborator

This is a bug - it has never worked.

@martincostello
Copy link
Collaborator

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.

martincostello added a commit to martincostello/Swashbuckle.AspNetCore that referenced this issue Aug 12, 2024
- Fix form parameters not being annotated with XML documentation.
- Refactor filter to use modern C# and be slightly more efficient.
- Remove commented-out code in test controller.

Resolves domaindrivendev#3018.
@qcjxberin
Copy link
Author

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

@martincostello
Copy link
Collaborator

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.

@qcjxberin
Copy link
Author

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

@martincostello
Copy link
Collaborator

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

@qcjxberin
Copy link
Author

Okay, thank you so much for your support

@martincostello
Copy link
Collaborator

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

@martincostello
Copy link
Collaborator

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

@qcjxberin
Copy link
Author

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

@qcjxberin
Copy link
Author

image

@martincostello
Copy link
Collaborator

martincostello commented Aug 23, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants