< Summary - Kestrun — Combined Coverage

Information
Class: OpenApiProperties
Assembly: Kestrun.Annotations
File(s): /home/runner/work/Kestrun/Kestrun/src/CSharp/Kestrun.Annotations/OpenApi/Attributes/OpenApiProperties.cs
Tag: Kestrun/Kestrun@eeafbe813231ed23417e7b339e170e307b2c86f9
Line coverage
71%
Covered lines: 38
Uncovered lines: 15
Coverable lines: 53
Total lines: 165
Line coverage: 71.6%
Branch coverage
100%
Covered branches: 2
Total branches: 2
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100 12/12/2025 - 17:27:19 Line coverage: 52% (25/48) Total lines: 139 Tag: Kestrun/Kestrun@826bf9dcf9db118c5de4c78a3259bce9549f0dcd01/02/2026 - 21:56:10 Line coverage: 56.2% (27/48) Total lines: 139 Tag: Kestrun/Kestrun@f60326065ebb24cf70b241e459b37baf142e6ed601/12/2026 - 18:03:06 Line coverage: 57.4% (27/47) Total lines: 138 Tag: Kestrun/Kestrun@956332ccc921363590dccd99d5707fb20b50966b01/21/2026 - 17:07:46 Line coverage: 68% (32/47) Total lines: 138 Tag: Kestrun/Kestrun@3f6f61710c7ef7d5953cab578fe699c1e5e01a3602/05/2026 - 00:28:18 Line coverage: 71.6% (38/53) Branch coverage: 100% (2/2) Total lines: 165 Tag: Kestrun/Kestrun@d9261bd752e45afa789d10bc0c82b7d5724d9589 02/05/2026 - 00:28:18 Line coverage: 71.6% (38/53) Branch coverage: 100% (2/2) Total lines: 165 Tag: Kestrun/Kestrun@d9261bd752e45afa789d10bc0c82b7d5724d9589

Coverage delta

Coverage delta 11 -11

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_Title()100%11100%
get_Description()100%11100%
get_Type()100%11100%
get_Format()100%11100%
get_Default()100%11100%
get_Example()100%11100%
get_Nullable()100%11100%
get_ReadOnly()100%11100%
get_WriteOnly()100%11100%
get_Deprecated()100%11100%
get_Array()100%11100%
get_MultipleOf()100%11100%
get_Maximum()100%11100%
get_ExclusiveMaximum()100%210%
get_Minimum()100%11100%
get_ExclusiveMinimum()100%210%
get_MaxLength()100%11100%
get_MinLength()100%11100%
get_Pattern()100%11100%
get_MaxItems()100%11100%
get_MinItems()100%11100%
get_UniqueItems()100%11100%
get_MaxProperties()100%11100%
get_MinProperties()100%11100%
get_RequiredProperties()100%11100%
get_Enum()100%11100%
get_SchemaType()100%11100%
get_ItemsType()100%11100%
get_AdditionalPropertiesAllowed()100%11100%
get_AdditionalProperties()100%11100%
set_AdditionalProperties(...)100%22100%
get_OneOfRefs()100%210%
get_AnyOfRefs()100%210%
get_AllOfRefs()100%210%
get_NotRef()100%210%
get_OneOfTypes()100%210%
get_AnyOfTypes()100%210%
get_AllOfTypes()100%210%
get_NotType()100%210%
get_DiscriminatorPropertyName()100%210%
get_DiscriminatorMappingKeys()100%210%
get_DiscriminatorMappingRefs()100%210%
get_ExternalDocsUrl()100%210%
get_ExternalDocsDescription()100%210%
get_XmlName()100%11100%
get_XmlNamespace()100%11100%
get_XmlPrefix()100%11100%
get_XmlAttribute()100%11100%
get_XmlWrapped()100%11100%
get_UnevaluatedProperties()100%11100%

File(s)

/home/runner/work/Kestrun/Kestrun/src/CSharp/Kestrun.Annotations/OpenApi/Attributes/OpenApiProperties.cs

#LineLine coverage
 1
 2/// <summary>
 3/// Rich OpenAPI schema metadata for a property or a class.
 4/// Apply to:
 5/// <list type="bullet">
 6/// <item><description>Class (object-level): set <see cref="RequiredProperties"/> array, XML hints, discriminator, etc.<
 7/// <item><description>Property (member-level): set description, format, constraints, enum, etc.</description></item>
 8/// </list>
 9/// </summary>
 10public abstract class OpenApiProperties : KestrunAnnotation
 11{
 12    /// <summary>
 13    /// Type of additionalProperties (if allowed).
 14    /// </summary>
 15    private Type? _additionalProperties;
 16
 17    /// <summary>
 18    /// Human-friendly title for the schema.
 19    /// </summary>
 6020    public string? Title { get; set; }
 21    /// <summary>Markdown-capable description.</summary>
 24622    public string? Description { get; set; }
 23
 24    /// <summary>Explicit OpenAPI type override (otherwise inferred).</summary>
 7225    public OaSchemaType Type { get; set; } = OaSchemaType.None;
 5226    public string? Format { get; set; }
 27    /// <summary>Default value.</summary>
 5228    public object? Default { get; set; }
 29    /// <summary>Example value (single example).</summary>
 5430    public object? Example { get; set; }
 31    /// <summary>Marks the schema as nullable (OAS 3.0).</summary>
 5232    public bool Nullable { get; set; }
 33    /// <summary>Indicates the value is read-only (responses only).</summary>
 5234    public bool ReadOnly { get; set; }
 35    /// <summary>Indicates the value is write-only (requests only).</summary>
 5236    public bool WriteOnly { get; set; }
 37    /// <summary>Marks the schema/property as deprecated.</summary>
 5038    public bool Deprecated { get; set; }
 39    /// <summary>
 40    /// Indicates the property is an array (enables array constraints).
 41    /// </summary>
 1642    public bool Array { get; set; }
 43    // ---- Numbers ----
 44    /// <summary>Value must be a multiple of this.</summary>
 5245    public decimal? MultipleOf { get; set; }
 46    /// <summary>Inclusive maximum.</summary>
 5247    public string? Maximum { get; set; }
 48    /// <summary>Exclusive maximum flag.</summary>
 049    public bool ExclusiveMaximum { get; set; }
 50    /// <summary>Inclusive minimum.</summary>
 5251    public string? Minimum { get; set; }
 52    /// <summary>Exclusive minimum flag.</summary>
 053    public bool ExclusiveMinimum { get; set; }
 54
 55    // ---- Strings ----
 56    /// <summary>Maximum length (characters).</summary>
 34757    public int MaxLength { get; set; } = -1;
 58    /// <summary>Minimum length (characters).</summary>
 34759    public int MinLength { get; set; } = -1;
 60    /// <summary>ECMA-262 compliant regex.</summary>
 5261    public string? Pattern { get; set; }
 62
 63    // ---- Arrays ----
 64    /// <summary>Max items in array.</summary>
 34765    public int MaxItems { get; set; } = -1;
 66    /// <summary>Min items in array.</summary>
 34767    public int MinItems { get; set; } = -1;
 68    /// <summary>Items must be unique.</summary>
 5269    public bool UniqueItems { get; set; }
 70
 71    // ---- Objects ----
 72    /// <summary>Max properties an object may contain.</summary>
 34773    public int MaxProperties { get; set; } = -1;
 74    /// <summary>Min properties an object must contain.</summary>
 34775    public int MinProperties { get; set; } = -1;
 76
 77    /// <summary>
 78    /// Object-level required property names (apply this on the CLASS).
 79    /// </summary>
 6580    public string[]? RequiredProperties { get; set; }
 81
 82    // ---- Enum ----
 83    /// <summary>Allowed constant values for the schema.</summary>
 5284    public object[]? Enum { get; set; }
 85
 86    /// <summary>
 87    /// Schema type by .NET type for code-first generators.
 88    /// </summary>
 3389    public Type? SchemaType { get; set; }
 90
 91    // ---- Array typing ----
 92    /// <summary>Items type by OpenAPI reference (e.g., "#/components/schemas/Address").</summary>
 93    /// <summary>Items type by .NET type for code-first generators.</summary>
 194    public Type? ItemsType { get; set; }
 95
 96    /// <summary>
 97    ///  Indicates whether additionalProperties are allowed (default: false).
 98    /// </summary>
 67499    public bool AdditionalPropertiesAllowed { get; set; } = true;
 100
 101    /// <summary>
 102    /// Type of additionalProperties (if allowed).
 103    /// </summary>
 104    /// <remarks>Set AdditionalPropertiesAllowed to true if this is set.</remarks>
 105    public Type? AdditionalProperties
 106    {
 33107        get => _additionalProperties;
 108        set
 109        {
 25110            _additionalProperties = value;
 25111            if (value != null)
 112            {
 25113                AdditionalPropertiesAllowed = true;
 114            }
 25115        }
 116    }
 117
 118    // ---- Composition ----
 119    /// <summary>oneOf refs (by $ref).</summary>
 0120    public string[]? OneOfRefs { get; set; }
 121    /// <summary>anyOf refs (by $ref).</summary>
 0122    public string[]? AnyOfRefs { get; set; }
 123    /// <summary>allOf refs (by $ref).</summary>
 0124    public string[]? AllOfRefs { get; set; }
 125    /// <summary>not ref (by $ref).</summary>
 0126    public string? NotRef { get; set; }
 127    /// <summary>oneOf types (by .NET type).</summary>
 0128    public Type[]? OneOfTypes { get; set; }
 129    /// <summary>anyOf types (by .NET type).</summary>
 0130    public Type[]? AnyOfTypes { get; set; }
 131    /// <summary>allOf types (by .NET type).</summary>
 0132    public Type[]? AllOfTypes { get; set; }
 133    /// <summary>not type (by .NET type).</summary>
 0134    public Type? NotType { get; set; }
 135
 136    // ---- Discriminator ----
 137    /// <summary>Name of the property used to discriminate between schemas.</summary>
 0138    public string? DiscriminatorPropertyName { get; set; }
 139    /// <summary>Payload values matched by the discriminator.</summary>
 0140    public string[]? DiscriminatorMappingKeys { get; set; }
 141    /// <summary>Schema $refs that correspond to the mapping keys.</summary>
 0142    public string[]? DiscriminatorMappingRefs { get; set; }
 143
 144    // ---- External Docs ----
 145    /// <summary>External documentation URL.</summary>
 0146    public string? ExternalDocsUrl { get; set; }
 147    /// <summary>Description for the external docs.</summary>
 0148    public string? ExternalDocsDescription { get; set; }
 149
 150    // ---- XML ----
 151    /// <summary>XML element/attribute name.</summary>
 64152    public string? XmlName { get; set; }
 153    /// <summary>XML namespace.</summary>
 62154    public string? XmlNamespace { get; set; }
 155    /// <summary>XML prefix.</summary>
 58156    public string? XmlPrefix { get; set; }
 157    /// <summary>Indicates the property is an XML attribute.</summary>
 57158    public bool XmlAttribute { get; set; }
 159    /// <summary>Indicates arrays are wrapped in an enclosing element.</summary>
 54160    public bool XmlWrapped { get; set; }
 161    /// <summary>
 162    /// Sets unevaluatedProperties for OpenAPI Schema (null = generator decides).
 163    /// </summary>
 52164    public bool UnevaluatedProperties { get; set; }
 165}