Skip to content
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

.Net: Bug: OpenApiDocumentParser fail when X-API-version is provide in the content key #9952

Closed
mickaelropars opened this issue Dec 12, 2024 · 0 comments · Fixed by #9959
Closed
Assignees
Labels
bug Something isn't working .NET Issue or Pull requests regarding .NET code

Comments

@mickaelropars
Copy link

mickaelropars commented Dec 12, 2024

Describe the bug
in open OpenApiDocumentParser there is a bug whille retreiving the media type, from the response schema when the content has multiple attribute (in my case the x-api-version was also described)

To Reproduce
In the OpenApi schema we can have multiple type of information describing the content . In my case the description of the schema was "text/plain; x-api-version=2.0"

Expected behavior
OpenApiDocumentParser shall be able to retreive the mediatype from a complex content description

Platform

  • OS: Windows
  • IDE: Visual Studio
  • Language: C#
  • Source: Latest des

Additional context
Impact on the following methods of OpenApiDocumentParser

  • CreateRestApiOperationPayload
  • CreateRestApiOperationExpectedResponses

the line cause this error (in both methods)
var mediaType = s_supportedMediaTypes.FirstOrDefault(response.Value.Content.ContainsKey);

we should split and trim the splitted value to retrieve the mediatype

@mickaelropars mickaelropars added the bug Something isn't working label Dec 12, 2024
@markwallace-microsoft markwallace-microsoft added .NET Issue or Pull requests regarding .NET code triage labels Dec 12, 2024
@github-actions github-actions bot changed the title Bug: OpenApiDocumentParser fail when X-API-version is provide in the content key .Net: Bug: OpenApiDocumentParser fail when X-API-version is provide in the content key Dec 12, 2024
@markwallace-microsoft markwallace-microsoft moved this to Sprint: Planned in Semantic Kernel Dec 12, 2024
@markwallace-microsoft markwallace-microsoft moved this from Sprint: Planned to Sprint: In Progress in Semantic Kernel Dec 12, 2024
@markwallace-microsoft markwallace-microsoft moved this from Sprint: In Progress to Sprint: In Review in Semantic Kernel Dec 12, 2024
github-merge-queue bot pushed a commit that referenced this issue Dec 13, 2024
… the content key (#9959)

### Motivation and Context

1. Closes #9952
2. Also includes an OpenAI text embedding sample

### Description

<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->

### 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]>
@markwallace-microsoft markwallace-microsoft moved this from Sprint: In Review to Sprint: Done in Semantic Kernel Dec 13, 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
3 participants