namespace SimpleHttpServer.Types; /// /// Specifies the name of a http endpoint parameter. If this attribute is not specified, the variable name is used instead. /// [AttributeUsage(AttributeTargets.Parameter, Inherited = false, AllowMultiple = false)] public sealed class ParameterAttribute : Attribute { public string Name { get; } public bool IsOptional { get; } public ParameterAttribute(string name, bool isOptional = false) { if (string.IsNullOrWhiteSpace(name)) { throw new ArgumentException($"'{nameof(name)}' cannot be null or whitespace.", nameof(name)); } Name = name; IsOptional = isOptional; } }