Add expression converter for sample generation
What
Adds ExampleValueExpressionBuilder — converts InputExampleValue + CSharpType → ValueExpression (C# AST nodes). Also adds ExampleParameterValue bridge type. This is M2 of the test/sample generation feature.
How it works
The builder dispatches on CSharpType to produce the correct C# expression:
| Input | Output |
|---|---|
"hello" + string |
Literal("hello") |
"73f4..." + Guid |
Guid.Parse("73f4...") |
"http://..." + Uri |
new Uri("http://...") |
1234 + int |
Literal(1234) |
{...} + BinaryData |
BinaryData.FromObjectAsJson(new { ... }) |
[...] + IList<T> |
new T[] { ... } |
"Monday" + DayOfWeek |
DayOfWeek.Monday |
ExampleParameterValue supports two modes — pre-built Expression (for known params like credentials) or raw Value (for spec-provided data needing conversion).
Changes
- New:
ClientModel/src/Providers/Samples/ExampleValueExpressionBuilder.cs - New:
ClientModel/src/Providers/Samples/ExampleParameterValue.cs - New:
ClientModel/test/Providers/Samples/ExampleValueExpressionBuilderTests.cs(52 tests) - Modified:
Input/src/Properties/AssemblyInfo.cs— addedInternalsVisibleTofor Generator and ClientModel projects to access internal example subtypes (InputExampleRawValue, etc.)
Design doc
https://gist.github.com/radhgupta/9fee69190f1ac2252a88dd88f99de327
No changes needing a change description found.
Hi @@radhgupta. Your PR has had no update for 30 days and it is marked as a stale PR. If it is not updated within 30 days, the PR will automatically be closed. If you want to refresh the PR, please remove the stale label.
Hi @@radhgupta. The PR will be closed since the PR has no update for 28 days. If this is still relevant please reopen.