< Summary - ZhEaIsNsAaBn.Libraries coverage (affected: 23 packages)

Information
Class: ZhEaIsNsAaBn.Utilities.Swagger.SwaggerSchemaExampleAttribute
Assembly: ZhEaIsNsAaBn.Utilities.Swagger
File(s): /home/runner/work/ZhEaIsNsAaBn.Libraries.V1/ZhEaIsNsAaBn.Libraries.V1/src/UtilitiesPackages/ZhEaIsNsAaBn.Utilities.Swagger/Swagger/SwaggerSchemaExampleAttribute.cs
Line coverage
66%
Covered lines: 2
Uncovered lines: 1
Coverable lines: 3
Total lines: 38
Line coverage: 66.6%
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

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
.ctor(...)100%11100%
.ctor(...)100%210%

File(s)

/home/runner/work/ZhEaIsNsAaBn.Libraries.V1/ZhEaIsNsAaBn.Libraries.V1/src/UtilitiesPackages/ZhEaIsNsAaBn.Utilities.Swagger/Swagger/SwaggerSchemaExampleAttribute.cs

#LineLine coverage
 1#region Usings
 2using System.Globalization;
 3#endregion
 4
 5namespace ZhEaIsNsAaBn.Utilities.Swagger;
 6
 7/// <summary>
 8/// Sets the OpenAPI example for a property, parameter, class, struct or enum. Needs <see cref="SwaggerSchemaExampleFilt
 9/// registered with Swashbuckle.
 10/// </summary>
 11/// <example>
 12/// <code>
 13/// public sealed class CreateCustomerRequest
 14/// {
 15///     [ SwaggerSchemaExample( "Hassan" ) ]
 16///     public string Name { get; init; } = "";
 17/// }
 18/// </code>
 19/// </example>
 20[ AttributeUsage( AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Parameter | AttributeTargets.Prope
 21public sealed class SwaggerSchemaExampleAttribute : Attribute
 22{
 23    /// <summary>Uses a text example.</summary>
 24    /// <param name="example">The example value.</param>
 17625    public SwaggerSchemaExampleAttribute( string example ) => Example = example;
 26
 27    /// <summary>Uses a number example, written with the invariant culture.</summary>
 28    /// <param name="example">The example value.</param>
 7229    public SwaggerSchemaExampleAttribute( int example ) => Example = example.ToString( CultureInfo.InvariantCulture );
 30
 31    /// <summary>Uses a <see cref="Guid"/> example.</summary>
 32    /// <param name="example">The example value.</param>
 033    public SwaggerSchemaExampleAttribute( Guid example ) => Example = example.ToString();
 34
 35
 36    /// <summary>The example as text, as it appears in the OpenAPI document.</summary>
 37    public string Example { get; set; }
 38}