Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

AV0008: Invalid API version date

Value
Rule IDAV0008
CategoryUsage
Fix isBreaking

Cause

An API version expressed an invalid date.

Rule Description

When an API version is expressed as a date, the specified date must be valid.

Consider the following code:

[ApiController]
[ApiVersion(2026, 2, 29)]
[Route("[controller]")]
public class ExampleController : ControllerBase
{
    [HttpGet]
    public IActionResult Get() => Ok();
}

The date 2026-02-29 is not a valid API version because 2026 is not a leap year. This would not detected until runtime.

How to Fix Violations

Update the API version to be well-formed.

[ApiController]
[ApiVersion(2026, 2, 28)]
[Route("[controller]")]
public class ExampleController : ControllerBase
{
    [HttpGet]
    public IActionResult Get() => Ok();
}

When to Suppress Warnings

It is never safe to suppress this rule because a runtime exception will be thrown when the attribute is initialized.