Files
microsoft--semantic-kernel/dotnet/samples/GettingStartedWithProcesses/Step04/SchemaGenerator.cs
T
wehub-resource-sync b957a53def
CodeQL / Analyze (csharp) (push) Waiting to run
CodeQL / Analyze (python) (push) Waiting to run
chore: import upstream snapshot with attribution
2026-07-13 13:21:23 +08:00

27 lines
735 B
C#

// Copyright (c) Microsoft. All rights reserved.
using Microsoft.Extensions.AI;
using Microsoft.SemanticKernel;
namespace Step04;
internal static class JsonSchemaGenerator
{
private static readonly AIJsonSchemaCreateOptions s_config = new()
{
TransformOptions = new()
{
DisallowAdditionalProperties = true,
RequireAllProperties = true,
MoveDefaultKeywordToDescription = true,
}
};
/// <summary>
/// Wrapper for generating a JSON schema as string from a .NET type.
/// </summary>
public static string FromType<TSchemaType>()
{
return KernelJsonSchemaBuilder.Build(typeof(TSchemaType), "Intent Result", s_config).AsJson();
}
}