Skip to content

Conversation

@martincostello
Copy link
Collaborator

@martincostello martincostello commented Nov 29, 2025

Add a working Minimal API (the venerable "Todo" app) that is used to:

  • generate an OpenAPI document
  • generate a Kiota client from that OpenAPI document
  • verify functional interactions with the API using that generated client code

This was then used to create a repro for #3683, which is then fixed.

This also identified, via the use of https://apinotes.io/openapi-validator, that nullable shouldn't be emitted for OpenAPI 3.0 if type isn't, so that has also been resolved. Unfortunately I haven't yet found a validator that flags that that can be used in CI.

Also:

  • extends the tests for client generation with Kiota and NSwag to add code snapshots
  • adds a lint step using Spectral to validate any OpenAPI schema snapshots have no errors
  • validates the OpenAPI schema snapshots against their relevant OAS JSON schemas

TODO

Apply code review suggestions from #3686.
Add a functional Todo app with and API to use for further integration/end-to-end validation.
Add tests for Todo app before refactoring to use generated Kiota code.
Generate client code from Kiota for the Todo app.
Use Kiota-generated client to interact with the Todo app.
Add a snapshot test for the code generated by Kiota.
@codecov
Copy link

codecov bot commented Nov 29, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.66%. Comparing base (ed88a1b) to head (09c7c95).
⚠️ Report is 15 commits behind head on master.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3687      +/-   ##
==========================================
+ Coverage   94.64%   94.66%   +0.02%     
==========================================
  Files         111      111              
  Lines        3865     3861       -4     
  Branches      780      779       -1     
==========================================
- Hits         3658     3655       -3     
+ Misses        207      206       -1     
Flag Coverage Δ
Linux 94.66% <100.00%> (+0.02%) ⬆️
Windows 94.66% <100.00%> (+0.02%) ⬆️
macOS 94.66% <100.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Update the Todo app and tests to prepare to reproduce #3683.
The `nullable` property should not be emitted when `type` is not. Found via `https://apinotes.io/openapi-validator`.

Relates to #3649 and #3683.
Explicitly set the version to OpenAPI 3.0.
Validate the snapshots against the OpenAPI JSON schemas.
Validate snapshots of OpenAPI specifications with Spectral for errors.
Un-conditional assembly metadata for TFM.
Add snapshots for all of the client generation tests.
@martincostello martincostello added this to the v10.0.2 milestone Nov 30, 2025
@martincostello martincostello marked this pull request as ready for review November 30, 2025 16:07
Copilot AI review requested due to automatic review settings November 30, 2025 16:07
@martincostello martincostello merged commit a15b386 into master Nov 30, 2025
14 checks passed
@martincostello martincostello deleted the end-to-end-client-validation branch November 30, 2025 16:07
martincostello added a commit that referenced this pull request Nov 30, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds comprehensive end-to-end testing for client code generation from OpenAPI documents. A Todo API application serves as the test subject, with generated clients from both Kiota and NSwag validated for correctness. The PR also fixes issue #3683 related to nullable property emission and adds OpenAPI schema validation using Spectral.

  • Adds a working Todo Minimal API used to generate and test OpenAPI clients
  • Introduces code snapshots for generated Kiota and NSwag clients
  • Implements OpenAPI schema validation with Spectral and JSON schema validation

Reviewed changes

Copilot reviewed 160 out of 315 changed files in this pull request and generated no comments.

File Description
Multiple snapshot files Generated client code snapshots for NSwag and Kiota clients across various test scenarios
.spectral.yaml Configuration file enabling Spectral-based OpenAPI validation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

This was referenced Dec 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants