Skip to content

Respect [FromBody] parameter name when SerializeAsV2 body parameters #508

Closed

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:

// 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"
  }
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions