-
Notifications
You must be signed in to change notification settings - Fork 280
Closed
Milestone
Description
Issue
Current logic hard-coded [FromBody] parameter name as body when using SerializeAsV2 although [FromBody] parameter has its own name.
Hard-coded logic
The hard-coded logic is here:
OpenAPI.NET/src/Microsoft.OpenApi/Models/OpenApiOperation.cs
Lines 247 to 249 in be6a700
| // V2 spec actually allows the body to have custom name. | |
| // Our library does not support this at the moment. | |
| Name = "body", |
An example
For example, with the following API defined:
/// <summary>
/// Update
/// </summary>
/// <param name="payload">The payload</param>
[HttpPost("hub")]
public void Update([FromBody] string payload)
{
}The generated parameters section is always body although the parameter name is payload:
"parameters": [
{
"in": "body",
"name": "body",
"description": "The payload"
}
]Metadata
Metadata
Assignees
Labels
No labels