Skip to content

5.0.0-rc4 requestbody content is empty (OData) #1331

Closed
@spaasis

Description

@spaasis

Hi,
My Code in an ODataController:

/// <summary>
/// Partial update on a base unit
/// </summary>
/// <param name="key">Id of the base unit</param>
/// <param name="reason">Reason for the update</param>
/// <param name="baseUnit">The fields and values to update as JSON</param>
/// <returns></returns>
public async Task<IActionResult> Patch([FromODataUri] int key, string reason, [FromBody, BindRequired] Delta<BaseUnit> baseUnit) {
    ...
    return Ok();
}

Generates a swagger.json like:

"/api/StreamBaseUnits({key})": {
      "patch": {
        "tags": [
          "StreamBaseUnits"
        ],
        "summary": "Partial update on a base unit",
        "parameters": [
          {
            "name": "key",
            "in": "path",
            "description": "Id of the base unit",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "reason",
            "in": "query",
            "description": "Reason for the update",
            "schema": {
              "type": "string"
            }
          },
...
        ],
        "requestBody": {
          "description": "The fields and values to update as JSON",
          "content": { },
          "required": true
        },

Note the empty Content on the requestBody. This causes the request body to have no input in the url. Other methods in the same controller (GETs) work properly.

I've tried to change the parameter type to string/BaseUnit but it doesn't change anything.

As per #1076 I'm using the full .AddMvc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions