Examples not showing.
bug
### Describe the bug
The examples aren't appearing in the v1.json file.
### Steps To reproduce
```cs
.AddOpenApiExtensions(x => {
x.SerializationContexts.Add(TypedSerializerContext.Default);
x.AddXmlComments<Program>();
x.AddXmlComments<SdcDatabaseContext>();
x.AddExamples = true;
});
[OpenApiExample<SoftwareComponentKitCreateDto>]
public sealed class SoftwareComponentKitCreateDto : IExampleProvider<SoftwareComponentKitCreateDto>
{
...
#region IExampleProvider implementation
public static SoftwareComponentKitCreateDto GenerateExample() => new() {
HsdesId = "...",
IngredientVersions = [Guid.NewGuid(), Guid.NewGuid()],
Name = "...",
PlatformConfig = "...",
TeamcityBuildId = 658143,
TeamcityBuildTypeId = "...",
TeamcityServer = "...",
TeamcityUrl = "...",
UserRequestId = Guid.NewGuid(),
Version = "..."
};
#endregion
}
```
I don't know if I need the `AddExamples` explicitly? Your README didn't say anything about it that I saw.
### Expected behaviour
Have the examples appear :)
### Actual behaviour
No example data in the v1.json output
### System information
```
.NET SDK:
Version: 9.0.101
Commit: eedb237549
Workload version: 9.0.100-manifests.4a280210
MSBuild version: 17.12.12+1cce77968
Runtime Environment:
OS Name: Windows
OS Version: 10.0.22631
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\9.0.101\
.NET workloads installed:
[aspire]
Installation Source: VS 17.12.35527.113
Manifest Version: 8.2.2/8.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.aspire\8.2.2\WorkloadManifest.json
Install Type: Msi
Configured to use loose manifests when installing new manifests.
Host:
Version: 9.0.0
Architecture: x64
Commit: 9d5a6a9aa4
.NET SDKs installed:
9.0.101 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 8.0.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 8.0.11 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 9.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]
Environment variables:
Not set
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
```
关闭于 2025-01-10 3 条评论