< 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@0d738bf294e6281b936d031e1979d928007495ff
Line coverage
52%
Covered lines: 25
Uncovered lines: 23
Coverable lines: 48
Total lines: 139
Line coverage: 52%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
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@826bf9dcf9db118c5de4c78a3259bce9549f0dcd

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%210%
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_Required()100%11100%
get_Enum()100%11100%
get_ItemsRef()100%210%
get_ItemsType()100%210%
get_AdditionalPropertiesAllowed()100%11100%
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%210%
get_XmlNamespace()100%210%
get_XmlPrefix()100%210%
get_XmlAttribute()100%210%
get_XmlWrapped()100%210%
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="Required"/> array, XML hints, discriminator, etc.</descripti
 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    /// Human-friendly title for the schema.
 14    /// </summary>
 1415    public string? Title { get; set; }
 16    /// <summary>Markdown-capable description.</summary>
 2417    public string? Description { get; set; }
 18
 19    /// <summary>Explicit OpenAPI type override (otherwise inferred).</summary>
 620    public OaSchemaType Type { get; set; } = OaSchemaType.None;
 621    public string? Format { get; set; }
 22    /// <summary>Default value.</summary>
 623    public object? Default { get; set; }
 24    /// <summary>Example value (single example).</summary>
 1125    public object? Example { get; set; }
 26    /// <summary>Marks the schema as nullable (OAS 3.0).</summary>
 727    public bool Nullable { get; set; }
 28    /// <summary>Indicates the value is read-only (responses only).</summary>
 629    public bool ReadOnly { get; set; }
 30    /// <summary>Indicates the value is write-only (requests only).</summary>
 631    public bool WriteOnly { get; set; }
 32    /// <summary>Marks the schema/property as deprecated.</summary>
 633    public bool Deprecated { get; set; }
 34    /// <summary>
 35    /// Indicates the property is an array (enables array constraints).
 36    /// </summary>
 037    public bool Array { get; set; }
 38    // ---- Numbers ----
 39    /// <summary>Value must be a multiple of this.</summary>
 640    public decimal? MultipleOf { get; set; }
 41    /// <summary>Inclusive maximum.</summary>
 642    public string? Maximum { get; set; }
 43    /// <summary>Exclusive maximum flag.</summary>
 044    public bool ExclusiveMaximum { get; set; }
 45    /// <summary>Inclusive minimum.</summary>
 646    public string? Minimum { get; set; }
 47    /// <summary>Exclusive minimum flag.</summary>
 048    public bool ExclusiveMinimum { get; set; }
 49
 50    // ---- Strings ----
 51    /// <summary>Maximum length (characters).</summary>
 2052    public int MaxLength { get; set; } = -1;
 53    /// <summary>Minimum length (characters).</summary>
 2054    public int MinLength { get; set; } = -1;
 55    /// <summary>ECMA-262 compliant regex.</summary>
 656    public string? Pattern { get; set; }
 57
 58    // ---- Arrays ----
 59    /// <summary>Max items in array.</summary>
 2060    public int MaxItems { get; set; } = -1;
 61    /// <summary>Min items in array.</summary>
 2062    public int MinItems { get; set; } = -1;
 63    /// <summary>Items must be unique.</summary>
 664    public bool UniqueItems { get; set; }
 65
 66    // ---- Objects ----
 67    /// <summary>Max properties an object may contain.</summary>
 2068    public int MaxProperties { get; set; } = -1;
 69    /// <summary>Min properties an object must contain.</summary>
 2070    public int MinProperties { get; set; } = -1;
 71
 72    /// <summary>
 73    /// Object-level required property names (apply this on the CLASS).
 74    /// </summary>
 675    public string[]? Required { get; set; }
 76
 77    // ---- Enum ----
 78    /// <summary>Allowed constant values for the schema.</summary>
 679    public object[]? Enum { get; set; }
 80
 81    // ---- Array typing ----
 82    /// <summary>Items type by OpenAPI reference (e.g., "#/components/schemas/Address").</summary>
 083    public string? ItemsRef { get; set; }
 84    /// <summary>Items type by .NET type for code-first generators.</summary>
 085    public Type? ItemsType { get; set; }
 86
 87    /// <summary>
 88    ///  Indicates whether additionalProperties are allowed (default: false).
 89    /// </summary>
 2090    public bool AdditionalPropertiesAllowed { get; set; } = true;
 91
 92    // ---- Composition ----
 93    /// <summary>oneOf refs (by $ref).</summary>
 094    public string[]? OneOfRefs { get; set; }
 95    /// <summary>anyOf refs (by $ref).</summary>
 096    public string[]? AnyOfRefs { get; set; }
 97    /// <summary>allOf refs (by $ref).</summary>
 098    public string[]? AllOfRefs { get; set; }
 99    /// <summary>not ref (by $ref).</summary>
 0100    public string? NotRef { get; set; }
 101    /// <summary>oneOf types (by .NET type).</summary>
 0102    public Type[]? OneOfTypes { get; set; }
 103    /// <summary>anyOf types (by .NET type).</summary>
 0104    public Type[]? AnyOfTypes { get; set; }
 105    /// <summary>allOf types (by .NET type).</summary>
 0106    public Type[]? AllOfTypes { get; set; }
 107    /// <summary>not type (by .NET type).</summary>
 0108    public Type? NotType { get; set; }
 109
 110    // ---- Discriminator ----
 111    /// <summary>Name of the property used to discriminate between schemas.</summary>
 0112    public string? DiscriminatorPropertyName { get; set; }
 113    /// <summary>Payload values matched by the discriminator.</summary>
 0114    public string[]? DiscriminatorMappingKeys { get; set; }
 115    /// <summary>Schema $refs that correspond to the mapping keys.</summary>
 0116    public string[]? DiscriminatorMappingRefs { get; set; }
 117
 118    // ---- External Docs ----
 119    /// <summary>External documentation URL.</summary>
 0120    public string? ExternalDocsUrl { get; set; }
 121    /// <summary>Description for the external docs.</summary>
 0122    public string? ExternalDocsDescription { get; set; }
 123
 124    // ---- XML ----
 125    /// <summary>XML element/attribute name.</summary>
 0126    public string? XmlName { get; set; }
 127    /// <summary>XML namespace.</summary>
 0128    public string? XmlNamespace { get; set; }
 129    /// <summary>XML prefix.</summary>
 0130    public string? XmlPrefix { get; set; }
 131    /// <summary>Indicates the property is an XML attribute.</summary>
 0132    public bool XmlAttribute { get; set; }
 133    /// <summary>Indicates arrays are wrapped in an enclosing element.</summary>
 0134    public bool XmlWrapped { get; set; }
 135    /// <summary>
 136    /// Sets unevaluatedProperties for OpenAPI Schema (null = generator decides).
 137    /// </summary>
 6138    public bool UnevaluatedProperties { get; set; }
 139}