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: OpenApi function generation hits JSON serialization error for deep structures #4991

Closed
Tracked by #83
zengin opened this issue Feb 13, 2024 · 0 comments · Fixed by #4993
Closed
Tracked by #83

.Net: OpenApi function generation hits JSON serialization error for deep structures #4991

zengin opened this issue Feb 13, 2024 · 0 comments · Fixed by #4993
Labels
.NET Issue or Pull requests regarding .NET code triage

Comments

@zengin
Copy link
Contributor

zengin commented Feb 13, 2024

Describe the bug
Microsoft Graph's drive item content endpoint /drive/root/children/{driveItem-id}/content fails to generate a function in Semantic Kernel due to default serialization setting of depth of 64.

To Reproduce
It is easier to reproduce the error with API Manifest plugins due to availability of slicing. It uses OpenAPI path for function generation, so I built the repro on top of #4961, diff is here

Steps:

  1. gh repo clone zengin/semantic-kernel
  2. git checkout zengin/json-depth-test
  3. cd semantic-kernel/dotnet/samples/KernelSyntaxExamples
  4. dotnet test --filter Example80_ApiManifest --logger "console;verbosity=detailed"
  5. Observe the following error:
Error Message:
   System.AggregateException : Plugin creation failed for DriveItemPlugin (The maximum configured depth of 64 has been exceeded. Cannot read next JSON object. Path: $ | LineNumber: 10780 | BytePositionInLine: 134.)
---- System.Text.Json.JsonException : The maximum configured depth of 64 has been exceeded. Cannot read next JSON object. Path: $ | LineNumber: 10780 | BytePositionInLine: 134.
-------- System.Text.Json.JsonReaderException : The maximum configured depth of 64 has been exceeded. Cannot read next JSON object. LineNumber: 10780 | BytePositionInLine: 134.

Expected behavior
A plugin function is generated for drive item content endpoint

Additional context
Solution here

@shawncal shawncal added .NET Issue or Pull requests regarding .NET code triage labels Feb 13, 2024
@github-actions github-actions bot changed the title OpenApi function generation hits JSON serialization error for deep structures .Net: OpenApi function generation hits JSON serialization error for deep structures Feb 13, 2024
github-merge-queue bot pushed a commit that referenced this issue Feb 13, 2024
### Motivation and Context

-fixes #4991

### Description

- Sets the serialization depth to 128
- Changes can be tested on the branch linked in the issue description.

### Contribution Checklist

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

- [x] The code builds clean without any errors or warnings
- [x] 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
- [x] All unit tests pass, and I have added new tests where possible
- [x] I didn't break anyone 😄
github-merge-queue bot pushed a commit that referenced this issue Feb 22, 2024
### Motivation and Context

These examples were previously blocked by issue #4991

### Description

- Adds three more API Manifest plugin examples.

### Contribution Checklist

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

- [x] The code builds clean without any errors or warnings
- [x] 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
- [x] All unit tests pass, and I have added new tests where possible
- [x] I didn't break anyone 😄

Co-authored-by: SergeyMenshykh <68852919+SergeyMenshykh@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
.NET Issue or Pull requests regarding .NET code triage
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants