-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
schema/v5.0: introduce computable version ranges
The shorthand version of this schema is: defaultStatus: $status versions: [{ version: $version status: $status // unknown, affected, unaffected; unsupported? versionType: string (‘semver’, ‘git’, ..., to define meaning of <) repo: string (optional, intended for versionType ‘git’) limit: $versionLimit (this range stops just before limit; can use * for “infinity” aka "maxuint") changes: [{ at: version where status changes status: ... }] }] An object in the versions list can be either: - a simple {version: V, status: S}, which indicates the status of the single version V. - a range {version: V, versionType: T, limit: L, status: S, changes: C}, which indicates the status of the half-open interval [V, L) (that is, V is included but L is not). The range starts with V having status S and then changes over time according to the events listed in C. The algorithm for deciding the status of a particular version V is then: for entry in product.versions { if entry.lessThan is not present and entry.lessThanOrEqual is not present and v == entry.version { return entry.status } if (entry.lessThan is present and entry.version <= v and v < entry.lessThan) or (entry.lessThanOrEqual is present and entry.version <= v and v <= entry.lessThanOrEqual) { status = entry.status for change in entry.changes { if change.at <= v { status = change.status } } return status } } return product.defaultStatus Fixes #87. Fixes #12. Fixes #77.
- Loading branch information
Showing
1 changed file
with
75 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters