Repository navigation
feat(samples): add the Kiota extensions demo - #972
Merged
Merged
Conversation
A design-first task manager: Specs/TasksApi.yaml is the contract, the server implements it, and the app's client is generated from it with the Kiota CLI (pinned as a local tool in dotnet-tools.json). It covers JSON CRUD, query and path parameters, a typed 404, problem+json validation errors read per field, a text/plain status, a multipart upload and a 503 warm-up that Kiota's retry handler rides out. 21 headless tests run every operation through the app's own registration against the server in-process. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013G4Ls3q7cwW8sSEg5YgWHF
2 of 3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
UI/Http.KiotaExtensionsDemo, a single-project Uno app whose every HTTP call goes through a client the Kiota CLI generated from an OpenAPI document, registered with Uno.Extensions.Http.Kiota. It is design-first:Specs/TasksApi.yamlis the contract, the included server (Http.KiotaExtensionsDemo.Server, the template's-serverproject) implements it, and the app's client is generated from it.The sample was built by an agent from the
uno-kiotaskill alone, as a test of that skill (unoplatform/studio#215); the places the skill was wrong were fixed there.What it demonstrates
404(ApiError),400validation errors asapplication/problem+jsonshown per field, atext/plainstatus line, amultipart/form-dataupload, and a report that answers503withRetry-Afterwhile it warms up.AddKiotaClientgives the request adapter only Kiota's JSON factories, so thetext/plain, multipart andproblem+jsonoperations would all throwexpected a application/json content type.Services/TasksApiSetup.csdoes whatAddKiotaClientdoes with every serializer and still attaches Kiota's middleware, so the warm-up503s are retried.ApiClient:Urlin both appsettings files (without it the generated client silently calls the contract's placeholderserversURL), passed asoptionsso trimmed builds keep it ([Http] AddRefitClient and AddKiotaClient lose the endpoint Url in trimmed builds ("BaseAddress must be set on the HttpClient instance") uno.extensions#3266), the page's origin on WebAssembly, and10.0.2.2on the Android emulator.Services/TasksService.csmaps the generated models to the app's records, turns the error models into app exceptions, and reads theadditionalPropertiesmaps (validationerrors,byPriority) from Kiota's untyped nodes. MVUX Models only see records.WebApplicationFactory), including tests that pin the plain-AddKiotaClientfailures so the fix of [Http][Kiota] Only JSON serializer is added uno.extensions#2799 shows up as a failing test.dotnet-tools.jsonpins Kiota 1.37 as a local tool; the README's "Change the API" section is the step list (edit the contract, update the server,dotnet kiota update, map, test).Running it
Start the server (
dotnet run --project Http.KiotaExtensionsDemo.Server, port 5001), then run a head. The README covers each head and troubleshooting.Packages
Uno.Sdk7.0.0-dev.1158.0.0-dev.150HttpKiota)1.22.2kiota-lock.json)1.37.0The csproj keeps the Debug-only
Uno.WinUI.Lottiereference (unoplatform/uno.extensions#3262) and skips Uno's ICU initializer on the plainnet10.0target, without which the test project fails withFailed to load 'icuuc77'.Tested
dotnet test Http.KiotaExtensionsDemo.Tests).503retries, about 2 s), with no exceptions in the log; Release calls the configured server, not the placeholder.dotnet kiota update, a new test passing.🤖 Generated with Claude Code
https://claude.ai/code/session_013G4Ls3q7cwW8sSEg5YgWHF