| | | 1 | | namespace NexusLabs.Needlr.AgentFramework.Generators; |
| | | 2 | | |
| | | 3 | | /// <summary> |
| | | 4 | | /// Describes a single property of a complex object type used as an array element |
| | | 5 | | /// in an agent function parameter. Used for AOT-safe manual deserialization from |
| | | 6 | | /// JsonElement. |
| | | 7 | | /// </summary> |
| | | 8 | | internal readonly struct ObjectPropertyInfo |
| | | 9 | | { |
| | | 10 | | public ObjectPropertyInfo( |
| | | 11 | | string csharpName, |
| | | 12 | | string jsonName, |
| | | 13 | | string csharpTypeFullName, |
| | | 14 | | string schemaType, |
| | | 15 | | string? schemaFormat, |
| | | 16 | | bool isNullable, |
| | | 17 | | string? initDefaultLiteral) |
| | | 18 | | { |
| | 22 | 19 | | CSharpName = csharpName; |
| | 22 | 20 | | JsonName = jsonName; |
| | 22 | 21 | | CSharpTypeFullName = csharpTypeFullName; |
| | 22 | 22 | | SchemaType = schemaType; |
| | 22 | 23 | | SchemaFormat = schemaFormat; |
| | 22 | 24 | | IsNullable = isNullable; |
| | 22 | 25 | | InitDefaultLiteral = initDefaultLiteral; |
| | 22 | 26 | | } |
| | | 27 | | |
| | | 28 | | /// <summary>The C# property name (PascalCase, e.g., "Topic").</summary> |
| | 22 | 29 | | public string CSharpName { get; } |
| | | 30 | | |
| | | 31 | | /// <summary>The JSON property name (camelCase, e.g., "topic").</summary> |
| | 110 | 32 | | public string JsonName { get; } |
| | | 33 | | |
| | | 34 | | /// <summary>The fully-qualified C# type name (e.g., <c>"global::System.DateTimeOffset"</c>).</summary> |
| | 7 | 35 | | public string CSharpTypeFullName { get; } |
| | | 36 | | |
| | | 37 | | /// <summary>The JSON schema type (e.g., "string", "integer", "boolean").</summary> |
| | 22 | 38 | | public string SchemaType { get; } |
| | | 39 | | |
| | | 40 | | /// <summary> |
| | | 41 | | /// JSON Schema <c>format</c> hint for stringified value types (e.g., <c>"uuid"</c>, |
| | | 42 | | /// <c>"date-time"</c>, <c>"duration"</c>). <see langword="null"/> when no format applies. |
| | | 43 | | /// </summary> |
| | 16 | 44 | | public string? SchemaFormat { get; } |
| | | 45 | | |
| | | 46 | | /// <summary>Whether the property is nullable.</summary> |
| | 0 | 47 | | public bool IsNullable { get; } |
| | | 48 | | |
| | | 49 | | /// <summary> |
| | | 50 | | /// The C# literal expression for the property's initializer default, when present and |
| | | 51 | | /// expressible as a simple literal. For example, <c>"\"default\""</c> for |
| | | 52 | | /// <c>public string Foo { get; init; } = "default";</c> or <c>"5"</c> for |
| | | 53 | | /// <c>public int Count { get; init; } = 5;</c>. <see langword="null"/> when the |
| | | 54 | | /// property has no initializer (or the initializer is not a simple literal expression). |
| | | 55 | | /// Emitted as the fallback when a DTO payload supplies the property as |
| | | 56 | | /// <c>JsonValueKind.Null</c> / <c>JsonValueKind.Undefined</c>. |
| | | 57 | | /// </summary> |
| | 0 | 58 | | public string? InitDefaultLiteral { get; } |
| | | 59 | | } |