Table of Contents

Class SpecRangeAttribute

Namespace
WebDriverBiDi
Assembly
WebDriverBiDi.dll

Marks a command-parameter property with the numeric range the WebDriver BiDi specification defines for its value, so that Roslyn analyzers can read the range from compiled metadata as well as from source.

[AttributeUsage(AttributeTargets.Property)]
public sealed class SpecRangeAttribute : Attribute
Inheritance
SpecRangeAttribute
Inherited Members

Remarks

This attribute records the specification's range for documentation and tooling only. The library deliberately does not validate a property's value against this range at run time: a value the specification places outside the range is representable on the wire, and a conforming remote end rejects it when the command is executed. Bounds are inclusive of both Minimum and Maximum unless the corresponding exclusive flag is set: with MaximumExclusive a value equal to Maximum is outside the range (the specification's CDDL expresses such a range with the ... operator rather than ..), and with MinimumExclusive a value equal to Minimum is outside it (the CDDL .gt control operator, as opposed to .ge). Use NegativeInfinity or PositiveInfinity for a range that is unbounded on that side.

Some properties accept a reset sentinel value that falls outside the specification range (for example, a negative value that clears an override). Set HasSentinel to true and SentinelValue to that value so tooling does not treat it as out of range.

Constructors

SpecRangeAttribute(double, double)

Initializes a new instance of the SpecRangeAttribute class.

public SpecRangeAttribute(double minimum, double maximum)

Parameters

minimum double

The minimum value the specification allows, inclusive unless MinimumExclusive is set, or NegativeInfinity if unbounded below.

maximum double

The maximum value the specification allows, inclusive unless MaximumExclusive is set, or PositiveInfinity if unbounded above.

Properties

HasSentinel

Gets or sets a value indicating whether the property accepts a reset sentinel value outside the specification range. When true, SentinelValue is that value.

public bool HasSentinel { get; set; }

Property Value

bool

Maximum

Gets the maximum value the specification allows for the property. The bound is inclusive unless MaximumExclusive is set to true.

public double Maximum { get; }

Property Value

double

MaximumExclusive

Gets or sets a value indicating whether Maximum is an exclusive bound, so that a value equal to Maximum is outside the specification range. This corresponds to the specification's CDDL ... range operator, which excludes its upper bound.

public bool MaximumExclusive { get; set; }

Property Value

bool

Minimum

Gets the minimum value the specification allows for the property. The bound is inclusive unless MinimumExclusive is set to true.

public double Minimum { get; }

Property Value

double

MinimumExclusive

Gets or sets a value indicating whether Minimum is an exclusive bound, so that a value equal to Minimum is outside the specification range. This corresponds to the specification's CDDL .gt control operator, as opposed to .ge.

public bool MinimumExclusive { get; set; }

Property Value

bool

Remarks

An exclusive lower bound cannot in general be rewritten as an inclusive one: for an integer-valued member, .gt 1 happens to coincide with a minimum of 2, but for a floating-point member such as the specification's (float .gt 0.0) there is no smallest permitted value to name.

SentinelValue

Gets or sets the reset sentinel value the property accepts outside the specification range. This value is meaningful only when HasSentinel is true.

public double SentinelValue { get; set; }

Property Value

double