Repository navigation
Conversation
Add a duration def to common and use it for blueprint reviewFrequency and the risk timeframe, downtime, recovery and horizon properties. The pattern accepts the time part that reviewFrequency was missing, rejects weeks mixed with other designators, and timeframe and horizon now have a pattern at all. Signed-off-by: Srinivas Chippagiri <cvas22@gmail.com>
|
we had some changes in the docs lately. |
…-duration Signed-off-by: Srinivas Chippagiri <cvas22@gmail.com> # Conflicts: # schema/2.0/modules/cyclonedx-blueprint-2.0.schema.json # schema/2.0/modules/cyclonedx-risk-2.0.schema.json
|
Merged 2.0-dev in 7d67fe8. The two conflicts were the new examples on |
| "pattern": "^P(?!$)(\\d+Y)?(\\d+M)?(\\d+W)?(\\d+D)?$", | ||
| "description": "ISO 8601 duration for review frequency (e.g., `\"P3M\"` for quarterly).", | ||
| "description": "How often the blueprint is reviewed, as an [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) duration, for example `\"P3M\"` for quarterly.", | ||
| "examples": ["P1Y", "P3M", "P5W", "P23D"] |
There was a problem hiding this comment.
lets remove the examples - we have them at cyclonedx-common-2.0.schema.json#/$defs/duration
| "$ref": "cyclonedx-common-2.0.schema.json#/$defs/duration", | ||
| "title": "Timeframe", | ||
| "description": "The period over which the probability or frequency is assessed, expressed as an [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) duration, for example `\"P1Y\"` for one year.", | ||
| "examples": ["P1Y", "P1M", "P23DT23H", "PT1M"] |
There was a problem hiding this comment.
remove the examples, we already have them in
cyclonedx-common-2.0.schema.json#/$defs/duration
| "duration": { | ||
| "type": "string", | ||
| "title": "Duration", | ||
| "pattern": "^P(?!$)((\\d+Y)?(\\d+M)?(\\d+D)?(T(?=\\d)(\\d+H)?(\\d+M)?(\\d+(\\.\\d+)?S)?)?|\\d+W)$", |
There was a problem hiding this comment.
Right, I had that wrong. With the minimal pattern in 12abd5a this isn't an issue anymore.
| "duration": { | ||
| "type": "string", | ||
| "title": "Duration", | ||
| "pattern": "^P(?!$)((\\d+Y)?(\\d+M)?(\\d+D)?(T(?=\\d)(\\d+H)?(\\d+M)?(\\d+(\\.\\d+)?S)?)?|\\d+W)$", |
There was a problem hiding this comment.
After reading the ISO 8601 duration spec again and again, i recommend not using any complex format - it is in the obligation of the downstream users to adhere to the respective spec in full.
therefore, i recommend
- using this minimal
"pattern": "^P" - add
"minLength": 3(as inP1Y) - adjust the descitption to be minimal and reference the spec
[ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) duration - add a comment that explains that we dont want to duplicate an existing standard by adding a complex regex here.
@stevespringett WDYT?
There was a problem hiding this comment.
Makes sense to me, went with that in 12abd5a. The weeks test became a check that a bare P is rejected.
The pattern now only checks the leading P and a minimum length, and the full syntax is left to ISO 8601 itself. Signed-off-by: Srinivas Chippagiri <cvas22@gmail.com>
Signed-off-by: Srinivas Chippagiri <cvas22@gmail.com>
Fixes #1203
This adds a
durationdef to common, next totimestamp, and points the five duration properties at it: blueprintreviewFrequencyand risktimeframe,downtime,recoveryandhorizon. Descriptions now all link ISO 8601 the same way, and the examples live only on the shared def.Following the review, the pattern is kept minimal (
^PplusminLength: 3) with a$commentexplaining why. The full ISO 8601 syntax, including fractions and weeks, is left to the standard instead of being repeated as a regex here.Tests: a valid blueprint with a time part, an invalid one with a bare
P, and an invalid risk timeframe that's free text.