Skip to content

Encoding field of multipart/form-data body is incorrect #57083

@mikekistler

Description

@mikekistler

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

The operation in the generated OpenAPI for an endpoint that accepts a "binary" FromForm parameter (e.g. byte[]) has a requestBody that includes an encoding field with incorrect contents. The encoding field is generated as:

      "encoding": {
        "multipart/form-data": {
          "style": "form",
          "explode": true
        }
      }

But the OpenAPI specifcation says that encoding is:

A map between a property name and its encoding information. The key, being the property name, MUST exist in the schema as a property.

The encoding object shown above is incorrect because "multipart/form-data" is not a property name in the associated schema.

Expected Behavior

I'm not really sure what information this encoding is intended to convey. It might be possible to simply delete it. But if it is important for some reason then the key must be a property name in the schema.

Steps To Reproduce

This branch https://github.com/mikekistler/aspnet-openapi-examples/tree/bug-57082 contains a recreate for this problem in the FormBodiesApi.cs file.

Exceptions (if any)

No response

.NET Version

9.0.100-rc.1.24380.1

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions