< Summary

Information
Class: NexusLabs.Needlr.AgentFramework.Generators.AgentFunctionParameterInfo
Assembly: NexusLabs.Needlr.AgentFramework.Generators
File(s): /home/runner/work/needlr/needlr/src/NexusLabs.Needlr.AgentFramework.Generators/Models/AgentFunctionParameterInfo.cs
Line coverage
100%
Covered lines: 27
Uncovered lines: 0
Coverable lines: 27
Total lines: 82
Line coverage: 100%
Branch coverage
100%
Covered branches: 4
Total branches: 4
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
get_Name()100%11100%
get_TypeFullName()100%11100%
get_JsonSchemaType()100%11100%
get_JsonSchemaFormat()100%11100%
get_ItemJsonSchemaType()100%11100%
get_ItemObjectSchemaJson()100%11100%
get_ItemObjectProperties()100%11100%
get_ObjectSchemaJson()100%11100%
get_ObjectProperties()100%11100%
get_IsCancellationToken()100%11100%
get_IsNullable()100%11100%
get_HasDefault()100%11100%
get_DefaultLiteral()100%11100%
get_IsEnum()100%11100%
get_Description()100%11100%
get_IsRequired()100%44100%

File(s)

/home/runner/work/needlr/needlr/src/NexusLabs.Needlr.AgentFramework.Generators/Models/AgentFunctionParameterInfo.cs

#LineLine coverage
 1// Copyright (c) NexusLabs. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System.Collections.Generic;
 5
 6namespace NexusLabs.Needlr.AgentFramework.Generators;
 7
 8internal readonly struct AgentFunctionParameterInfo
 9{
 10    public AgentFunctionParameterInfo(
 11        string name, string typeFullName,
 12        string jsonSchemaType, string? jsonSchemaFormat,
 13        string? itemJsonSchemaType,
 14        string? itemObjectSchemaJson,
 15        IReadOnlyList<ObjectPropertyInfo>? itemObjectProperties,
 16        string? objectSchemaJson,
 17        IReadOnlyList<ObjectPropertyInfo>? objectProperties,
 18        bool isCancellationToken, bool isNullable, bool hasDefault,
 19        string? defaultLiteral, bool isEnum, string? description)
 20    {
 11021        Name = name; TypeFullName = typeFullName;
 11022        JsonSchemaType = jsonSchemaType; JsonSchemaFormat = jsonSchemaFormat;
 5523        ItemJsonSchemaType = itemJsonSchemaType;
 5524        ItemObjectSchemaJson = itemObjectSchemaJson;
 5525        ItemObjectProperties = itemObjectProperties;
 5526        ObjectSchemaJson = objectSchemaJson;
 5527        ObjectProperties = objectProperties;
 11028        IsCancellationToken = isCancellationToken; IsNullable = isNullable;
 11029        HasDefault = hasDefault; DefaultLiteral = defaultLiteral;
 11030        IsEnum = isEnum; Description = description;
 5531    }
 32
 48433    public string Name { get; }
 10934    public string TypeFullName { get; }
 25035    public string JsonSchemaType { get; }
 36    /// <summary>
 37    /// JSON Schema <c>format</c> hint for stringified value types (e.g., <c>"uuid"</c> for
 38    /// <see cref="System.Guid"/>, <c>"date-time"</c> for <see cref="System.DateTime"/>,
 39    /// <c>"duration"</c> for <see cref="System.TimeSpan"/>). <see langword="null"/> when no
 40    /// format applies.
 41    /// </summary>
 6842    public string? JsonSchemaFormat { get; }
 43    /// <summary>JSON schema type for array items (e.g., "string", "integer", "object").</summary>
 2644    public string? ItemJsonSchemaType { get; }
 45    /// <summary>Pre-built JSON schema for complex object array items (properties, required fields).</summary>
 1046    public string? ItemObjectSchemaJson { get; }
 47    /// <summary>Property extraction info for AOT-safe manual deserialization of complex array items.</summary>
 1048    public IReadOnlyList<ObjectPropertyInfo>? ItemObjectProperties { get; }
 49    /// <summary>
 50    /// Pre-built JSON schema for a top-level complex object parameter (properties, required
 51    /// fields). Set when <see cref="JsonSchemaType"/> is <c>"object"</c> AND the type has
 52    /// public properties suitable for property-level binding.
 53    /// </summary>
 1654    public string? ObjectSchemaJson { get; }
 55    /// <summary>
 56    /// Property extraction info for AOT-safe manual deserialization of a top-level complex
 57    /// object parameter. Mirrors <see cref="ItemObjectProperties"/> but applies to the
 58    /// parameter type itself rather than an array element.
 59    /// </summary>
 860    public IReadOnlyList<ObjectPropertyInfo>? ObjectProperties { get; }
 26161    public bool IsCancellationToken { get; }
 14262    public bool IsNullable { get; }
 10663    public bool HasDefault { get; }
 64    /// <summary>
 65    /// The C# literal expression for the parameter's default value, when
 66    /// <see cref="HasDefault"/> is <see langword="true"/>. For example, <c>"false"</c> for
 67    /// <c>bool flag = false</c>, <c>"5"</c> for <c>int max = 5</c>, <c>"\"x\""</c> for
 68    /// <c>string p = "x"</c>, or <c>"null"</c> for <c>string? p = null</c>. The literal is
 69    /// emitted directly into generated extraction code as the fallback when the model omits
 70    /// the argument or supplies <c>JsonValueKind.Null</c> / <c>JsonValueKind.Undefined</c>.
 71    /// </summary>
 1872    public string? DefaultLiteral { get; }
 73    /// <summary>
 74    /// <see langword="true"/> when the parameter type is a C# <see langword="enum"/>. Drives
 75    /// enum-aware extraction emission: the wrapper calls
 76    /// <c>GetStringArgument</c> then <c>Enum.Parse&lt;T&gt;(s, ignoreCase: true)</c> rather
 77    /// than directly assigning a <see cref="string"/> to an enum-typed variable.
 78    /// </summary>
 2079    public bool IsEnum { get; }
 6080    public string? Description { get; }
 9681    public bool IsRequired => !IsCancellationToken && !IsNullable && !HasDefault;
 82}