Skip to content

.Net: Bug: ImportPluginFromOpenApiAsync with multipart/form-data not working #8971

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

Closed
dariomalfatti-centropaghe opened this issue Sep 24, 2024 · 0 comments · Fixed by #9736
Closed
Assignees
Labels
bug Something isn't working .NET Issue or Pull requests regarding .NET code

Comments

@dariomalfatti-centropaghe

Describe the bug
Importing an OpenAPI json file generated by Swagger that include multipart/form-data body content got the error:
Microsoft.SemanticKernel.KernelException: Neither of the media types of is supported.

Manually removing the API with this kind of content, it works.

To Reproduce
Import a json file with an API like this example:

"/api/mensatest/ExcelImport/QuickImport": {
      "post": {
        "tags": [
          "ExcelImport"
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "File": {
                    "type": "string",
                    "format": "binary"
                  }
                }
              },
              "encoding": {
                "File": {
                  "style": "form"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ImportResultModelGenericResult"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImportResultModelGenericResult"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImportResultModelGenericResult"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          }
        },
        "security": [
          {
            "oauth2": [ ]
          }
        ]
      }
    },

Expected behavior
I'm was expecting that the file was correcly processed, ignoring the API with multipart/form-data content though.

Platform

  • OS: Windows 10
  • IDE: Visual Studio 2022
  • Language: C#
  • Source: NuGet package Microsoft.SemanticKernel.Core 1.20.0
@dariomalfatti-centropaghe dariomalfatti-centropaghe added the bug Something isn't working label Sep 24, 2024
@markwallace-microsoft markwallace-microsoft added .NET Issue or Pull requests regarding .NET code triage labels Sep 24, 2024
@github-actions github-actions bot changed the title Bug: ImportPluginFromOpenApiAsync with multipart/form-data not wrking .Net: Bug: ImportPluginFromOpenApiAsync with multipart/form-data not wrking Sep 24, 2024
@dariomalfatti-centropaghe dariomalfatti-centropaghe changed the title .Net: Bug: ImportPluginFromOpenApiAsync with multipart/form-data not wrking .Net: Bug: ImportPluginFromOpenApiAsync with multipart/form-data not working Sep 24, 2024
@markwallace-microsoft markwallace-microsoft self-assigned this Sep 24, 2024
github-merge-queue bot pushed a commit that referenced this issue Nov 19, 2024
…orted content types (#9736)

### Motivation and Context

Closes #8971 

### Description

Operations with unsupported content types should be ignored rather than
causing the import to fail.

### Contribution Checklist

<!-- Before submitting this PR, please make sure: -->

- [ ] The code builds clean without any errors or warnings
- [ ] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [ ] All unit tests pass, and I have added new tests where possible
- [ ] I didn't break anyone 😄

---------

Co-authored-by: SergeyMenshykh <[email protected]>
@github-project-automation github-project-automation bot moved this from Sprint: In Progress to Sprint: Done in Semantic Kernel Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working .NET Issue or Pull requests regarding .NET code
Projects
Archived in project
2 participants