Skip to content

Commit 19532fa

Browse files
fix(docs): update ver field validation specification per #502 (#645)
* fix(specs): update ver field validation specification per #502 - Add all 4 validation rules to ver field validation: 1. Version must be >= ID 2. First version requirement (moved from id validation) 3. Version increment rule 4. Document type consistency rule - Move versioning rule from id to ver validation - Update id validation to describe timestamp-based validation Closes #502 * fix(docs): add missing newline at end of signed_doc.json * fix(docs): improve formatting of ver field validation rules in documentation * fix(docs): update ID and version validation rules in signed document metadata - Refine ID validation to include timestamp thresholds for future and past limits. - Enhance version validation with detailed rules for versioning consistency and type matching. - Ensure clarity and consistency across documentation for signed documents. * fix(docs): enhance ID and version validation formatting in signed document metadata - Improve formatting for ID and version validation rules across multiple documentation files. - Ensure consistency in the presentation of validation criteria for better readability. - Update the signed_doc.json specification to reflect the new formatting standards. * fix(docs): enhance formatting of ID validation rules in signed document metadata - Improve formatting for ID validation rules across multiple documentation files to enhance readability. - Ensure consistent presentation of timestamp threshold criteria for better clarity. - Update the signed_doc.json specification to reflect the new formatting standards. * fix(docs): standardize formatting of ID validation rules in signed document metadata - Refine formatting for ID validation rules across multiple documentation files to enhance readability and consistency. - Ensure timestamp threshold criteria are clearly presented for both future and past limits. - Update the signed_doc.json specification to reflect the improved formatting standards. * fix(docs): enhance formatting of ID validation rules in signed document metadata - Standardize the presentation of ID validation rules across multiple documentation files to improve readability. - Add missing newlines for better separation of criteria related to timestamp thresholds for future and past limits. - Update the signed_doc.json specification to reflect the improved formatting standards. * fix(docs): correct formatting in metadata template validation description * regenerate * wip * wip * wip --------- Co-authored-by: Alex Pozhylenkov <[email protected]>
1 parent f08d044 commit 19532fa

29 files changed

+591
-260
lines changed

docs/src/architecture/08_concepts/signed_doc/docs/brand_parameters.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,13 @@ timestamp of when the document was created.
8686

8787
#### [`id`](../metadata.md#id) Validation
8888

89-
IF [`ver`](../metadata.md#ver) does not == [`id`](../metadata.md#id) then a document with
90-
[`id`](../metadata.md#id) and [`ver`](../metadata.md#ver) being equal *MUST* exist.
89+
The document ID validation is performed based on timestamp thresholds:
90+
91+
* If `future_threshold` is configured,
92+
the document [`id`](../metadata.md#id) cannot be too far in the future from the
93+
current time.
94+
* If `past_threshold` is configured, the document [`id`](../metadata.md#id) cannot be too far in the past from the
95+
current time.
9196

9297
### [`ver`](../metadata.md#ver)
9398

@@ -104,7 +109,15 @@ The first version of the document must set [`ver`](../metadata.md#ver) == [`id`]
104109

105110
#### [`ver`](../metadata.md#ver) Validation
106111

107-
The document version must always be >= the document ID.
112+
1. The document version must always be >= the document ID.
113+
2. IF [`ver`](../metadata.md#ver) does not == [`id`](../metadata.md#id)
114+
then a document with [`id`](../metadata.md#id) and [`ver`](../metadata.md#ver) being equal *MUST* exist.
115+
3. When a document with the same [`id`](../metadata.md#id) already exists,
116+
the new document's [`ver`](../metadata.md#ver) must be greater than
117+
the latest known submitted version for that [`id`](../metadata.md#id).
118+
4. When a document with the same [`id`](../metadata.md#id) already exists,
119+
the new document's [`type`](../metadata.md#type) must be the same as
120+
the latest known submitted document's [`type`](../metadata.md#type) for that [`id`](../metadata.md#id).
108121

109122
### [`template`](../metadata.md#template)
110123

docs/src/architecture/08_concepts/signed_doc/docs/brand_parameters_form_template.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,13 @@ timestamp of when the document was created.
9191

9292
#### [`id`](../metadata.md#id) Validation
9393

94-
IF [`ver`](../metadata.md#ver) does not == [`id`](../metadata.md#id) then a document with
95-
[`id`](../metadata.md#id) and [`ver`](../metadata.md#ver) being equal *MUST* exist.
94+
The document ID validation is performed based on timestamp thresholds:
95+
96+
* If `future_threshold` is configured,
97+
the document [`id`](../metadata.md#id) cannot be too far in the future from the
98+
current time.
99+
* If `past_threshold` is configured, the document [`id`](../metadata.md#id) cannot be too far in the past from the
100+
current time.
96101

97102
### [`ver`](../metadata.md#ver)
98103

@@ -109,7 +114,15 @@ The first version of the document must set [`ver`](../metadata.md#ver) == [`id`]
109114

110115
#### [`ver`](../metadata.md#ver) Validation
111116

112-
The document version must always be >= the document ID.
117+
1. The document version must always be >= the document ID.
118+
2. IF [`ver`](../metadata.md#ver) does not == [`id`](../metadata.md#id)
119+
then a document with [`id`](../metadata.md#id) and [`ver`](../metadata.md#ver) being equal *MUST* exist.
120+
3. When a document with the same [`id`](../metadata.md#id) already exists,
121+
the new document's [`ver`](../metadata.md#ver) must be greater than
122+
the latest known submitted version for that [`id`](../metadata.md#id).
123+
4. When a document with the same [`id`](../metadata.md#id) already exists,
124+
the new document's [`type`](../metadata.md#type) must be the same as
125+
the latest known submitted document's [`type`](../metadata.md#type) for that [`id`](../metadata.md#id).
113126

114127
## Payload
115128

docs/src/architecture/08_concepts/signed_doc/docs/campaign_parameters.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,13 @@ timestamp of when the document was created.
8787

8888
#### [`id`](../metadata.md#id) Validation
8989

90-
IF [`ver`](../metadata.md#ver) does not == [`id`](../metadata.md#id) then a document with
91-
[`id`](../metadata.md#id) and [`ver`](../metadata.md#ver) being equal *MUST* exist.
90+
The document ID validation is performed based on timestamp thresholds:
91+
92+
* If `future_threshold` is configured,
93+
the document [`id`](../metadata.md#id) cannot be too far in the future from the
94+
current time.
95+
* If `past_threshold` is configured, the document [`id`](../metadata.md#id) cannot be too far in the past from the
96+
current time.
9297

9398
### [`ver`](../metadata.md#ver)
9499

@@ -105,7 +110,15 @@ The first version of the document must set [`ver`](../metadata.md#ver) == [`id`]
105110

106111
#### [`ver`](../metadata.md#ver) Validation
107112

108-
The document version must always be >= the document ID.
113+
1. The document version must always be >= the document ID.
114+
2. IF [`ver`](../metadata.md#ver) does not == [`id`](../metadata.md#id)
115+
then a document with [`id`](../metadata.md#id) and [`ver`](../metadata.md#ver) being equal *MUST* exist.
116+
3. When a document with the same [`id`](../metadata.md#id) already exists,
117+
the new document's [`ver`](../metadata.md#ver) must be greater than
118+
the latest known submitted version for that [`id`](../metadata.md#id).
119+
4. When a document with the same [`id`](../metadata.md#id) already exists,
120+
the new document's [`type`](../metadata.md#type) must be the same as
121+
the latest known submitted document's [`type`](../metadata.md#type) for that [`id`](../metadata.md#id).
109122

110123
### [`template`](../metadata.md#template)
111124

docs/src/architecture/08_concepts/signed_doc/docs/campaign_parameters_form_template.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,13 @@ timestamp of when the document was created.
9191

9292
#### [`id`](../metadata.md#id) Validation
9393

94-
IF [`ver`](../metadata.md#ver) does not == [`id`](../metadata.md#id) then a document with
95-
[`id`](../metadata.md#id) and [`ver`](../metadata.md#ver) being equal *MUST* exist.
94+
The document ID validation is performed based on timestamp thresholds:
95+
96+
* If `future_threshold` is configured,
97+
the document [`id`](../metadata.md#id) cannot be too far in the future from the
98+
current time.
99+
* If `past_threshold` is configured, the document [`id`](../metadata.md#id) cannot be too far in the past from the
100+
current time.
96101

97102
### [`ver`](../metadata.md#ver)
98103

@@ -109,7 +114,15 @@ The first version of the document must set [`ver`](../metadata.md#ver) == [`id`]
109114

110115
#### [`ver`](../metadata.md#ver) Validation
111116

112-
The document version must always be >= the document ID.
117+
1. The document version must always be >= the document ID.
118+
2. IF [`ver`](../metadata.md#ver) does not == [`id`](../metadata.md#id)
119+
then a document with [`id`](../metadata.md#id) and [`ver`](../metadata.md#ver) being equal *MUST* exist.
120+
3. When a document with the same [`id`](../metadata.md#id) already exists,
121+
the new document's [`ver`](../metadata.md#ver) must be greater than
122+
the latest known submitted version for that [`id`](../metadata.md#id).
123+
4. When a document with the same [`id`](../metadata.md#id) already exists,
124+
the new document's [`type`](../metadata.md#type) must be the same as
125+
the latest known submitted document's [`type`](../metadata.md#type) for that [`id`](../metadata.md#id).
113126

114127
### [`parameters`](../metadata.md#parameters)
115128

docs/src/architecture/08_concepts/signed_doc/docs/category_parameters.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,13 @@ timestamp of when the document was created.
8787

8888
#### [`id`](../metadata.md#id) Validation
8989

90-
IF [`ver`](../metadata.md#ver) does not == [`id`](../metadata.md#id) then a document with
91-
[`id`](../metadata.md#id) and [`ver`](../metadata.md#ver) being equal *MUST* exist.
90+
The document ID validation is performed based on timestamp thresholds:
91+
92+
* If `future_threshold` is configured,
93+
the document [`id`](../metadata.md#id) cannot be too far in the future from the
94+
current time.
95+
* If `past_threshold` is configured, the document [`id`](../metadata.md#id) cannot be too far in the past from the
96+
current time.
9297

9398
### [`ver`](../metadata.md#ver)
9499

@@ -105,7 +110,15 @@ The first version of the document must set [`ver`](../metadata.md#ver) == [`id`]
105110

106111
#### [`ver`](../metadata.md#ver) Validation
107112

108-
The document version must always be >= the document ID.
113+
1. The document version must always be >= the document ID.
114+
2. IF [`ver`](../metadata.md#ver) does not == [`id`](../metadata.md#id)
115+
then a document with [`id`](../metadata.md#id) and [`ver`](../metadata.md#ver) being equal *MUST* exist.
116+
3. When a document with the same [`id`](../metadata.md#id) already exists,
117+
the new document's [`ver`](../metadata.md#ver) must be greater than
118+
the latest known submitted version for that [`id`](../metadata.md#id).
119+
4. When a document with the same [`id`](../metadata.md#id) already exists,
120+
the new document's [`type`](../metadata.md#type) must be the same as
121+
the latest known submitted document's [`type`](../metadata.md#type) for that [`id`](../metadata.md#id).
109122

110123
### [`template`](../metadata.md#template)
111124

docs/src/architecture/08_concepts/signed_doc/docs/category_parameters_form_template.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,13 @@ timestamp of when the document was created.
9191

9292
#### [`id`](../metadata.md#id) Validation
9393

94-
IF [`ver`](../metadata.md#ver) does not == [`id`](../metadata.md#id) then a document with
95-
[`id`](../metadata.md#id) and [`ver`](../metadata.md#ver) being equal *MUST* exist.
94+
The document ID validation is performed based on timestamp thresholds:
95+
96+
* If `future_threshold` is configured,
97+
the document [`id`](../metadata.md#id) cannot be too far in the future from the
98+
current time.
99+
* If `past_threshold` is configured, the document [`id`](../metadata.md#id) cannot be too far in the past from the
100+
current time.
96101

97102
### [`ver`](../metadata.md#ver)
98103

@@ -109,7 +114,15 @@ The first version of the document must set [`ver`](../metadata.md#ver) == [`id`]
109114

110115
#### [`ver`](../metadata.md#ver) Validation
111116

112-
The document version must always be >= the document ID.
117+
1. The document version must always be >= the document ID.
118+
2. IF [`ver`](../metadata.md#ver) does not == [`id`](../metadata.md#id)
119+
then a document with [`id`](../metadata.md#id) and [`ver`](../metadata.md#ver) being equal *MUST* exist.
120+
3. When a document with the same [`id`](../metadata.md#id) already exists,
121+
the new document's [`ver`](../metadata.md#ver) must be greater than
122+
the latest known submitted version for that [`id`](../metadata.md#id).
123+
4. When a document with the same [`id`](../metadata.md#id) already exists,
124+
the new document's [`type`](../metadata.md#type) must be the same as
125+
the latest known submitted document's [`type`](../metadata.md#type) for that [`id`](../metadata.md#id).
113126

114127
### [`parameters`](../metadata.md#parameters)
115128

docs/src/architecture/08_concepts/signed_doc/docs/comment_moderation_action.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,13 @@ timestamp of when the document was created.
7777

7878
#### [`id`](../metadata.md#id) Validation
7979

80-
IF [`ver`](../metadata.md#ver) does not == [`id`](../metadata.md#id) then a document with
81-
[`id`](../metadata.md#id) and [`ver`](../metadata.md#ver) being equal *MUST* exist.
80+
The document ID validation is performed based on timestamp thresholds:
81+
82+
* If `future_threshold` is configured,
83+
the document [`id`](../metadata.md#id) cannot be too far in the future from the
84+
current time.
85+
* If `past_threshold` is configured, the document [`id`](../metadata.md#id) cannot be too far in the past from the
86+
current time.
8287

8388
### [`ver`](../metadata.md#ver)
8489

@@ -95,7 +100,15 @@ The first version of the document must set [`ver`](../metadata.md#ver) == [`id`]
95100

96101
#### [`ver`](../metadata.md#ver) Validation
97102

98-
The document version must always be >= the document ID.
103+
1. The document version must always be >= the document ID.
104+
2. IF [`ver`](../metadata.md#ver) does not == [`id`](../metadata.md#id)
105+
then a document with [`id`](../metadata.md#id) and [`ver`](../metadata.md#ver) being equal *MUST* exist.
106+
3. When a document with the same [`id`](../metadata.md#id) already exists,
107+
the new document's [`ver`](../metadata.md#ver) must be greater than
108+
the latest known submitted version for that [`id`](../metadata.md#id).
109+
4. When a document with the same [`id`](../metadata.md#id) already exists,
110+
the new document's [`type`](../metadata.md#type) must be the same as
111+
the latest known submitted document's [`type`](../metadata.md#type) for that [`id`](../metadata.md#id).
99112

100113
### [`ref`](../metadata.md#ref)
101114

docs/src/architecture/08_concepts/signed_doc/docs/contest_ballot.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,13 @@ timestamp of when the document was created.
8888

8989
#### [`id`](../metadata.md#id) Validation
9090

91-
IF [`ver`](../metadata.md#ver) does not == [`id`](../metadata.md#id) then a document with
92-
[`id`](../metadata.md#id) and [`ver`](../metadata.md#ver) being equal *MUST* exist.
91+
The document ID validation is performed based on timestamp thresholds:
92+
93+
* If `future_threshold` is configured,
94+
the document [`id`](../metadata.md#id) cannot be too far in the future from the
95+
current time.
96+
* If `past_threshold` is configured, the document [`id`](../metadata.md#id) cannot be too far in the past from the
97+
current time.
9398

9499
### [`ver`](../metadata.md#ver)
95100

@@ -106,7 +111,15 @@ The first version of the document must set [`ver`](../metadata.md#ver) == [`id`]
106111

107112
#### [`ver`](../metadata.md#ver) Validation
108113

109-
The document version must always be >= the document ID.
114+
1. The document version must always be >= the document ID.
115+
2. IF [`ver`](../metadata.md#ver) does not == [`id`](../metadata.md#id)
116+
then a document with [`id`](../metadata.md#id) and [`ver`](../metadata.md#ver) being equal *MUST* exist.
117+
3. When a document with the same [`id`](../metadata.md#id) already exists,
118+
the new document's [`ver`](../metadata.md#ver) must be greater than
119+
the latest known submitted version for that [`id`](../metadata.md#id).
120+
4. When a document with the same [`id`](../metadata.md#id) already exists,
121+
the new document's [`type`](../metadata.md#type) must be the same as
122+
the latest known submitted document's [`type`](../metadata.md#type) for that [`id`](../metadata.md#id).
110123

111124
### [`ref`](../metadata.md#ref)
112125

docs/src/architecture/08_concepts/signed_doc/docs/contest_ballot_checkpoint.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,13 @@ timestamp of when the document was created.
110110

111111
#### [`id`](../metadata.md#id) Validation
112112

113-
IF [`ver`](../metadata.md#ver) does not == [`id`](../metadata.md#id) then a document with
114-
[`id`](../metadata.md#id) and [`ver`](../metadata.md#ver) being equal *MUST* exist.
113+
The document ID validation is performed based on timestamp thresholds:
114+
115+
* If `future_threshold` is configured,
116+
the document [`id`](../metadata.md#id) cannot be too far in the future from the
117+
current time.
118+
* If `past_threshold` is configured, the document [`id`](../metadata.md#id) cannot be too far in the past from the
119+
current time.
115120

116121
### [`ver`](../metadata.md#ver)
117122

@@ -128,7 +133,15 @@ The first version of the document must set [`ver`](../metadata.md#ver) == [`id`]
128133

129134
#### [`ver`](../metadata.md#ver) Validation
130135

131-
The document version must always be >= the document ID.
136+
1. The document version must always be >= the document ID.
137+
2. IF [`ver`](../metadata.md#ver) does not == [`id`](../metadata.md#id)
138+
then a document with [`id`](../metadata.md#id) and [`ver`](../metadata.md#ver) being equal *MUST* exist.
139+
3. When a document with the same [`id`](../metadata.md#id) already exists,
140+
the new document's [`ver`](../metadata.md#ver) must be greater than
141+
the latest known submitted version for that [`id`](../metadata.md#id).
142+
4. When a document with the same [`id`](../metadata.md#id) already exists,
143+
the new document's [`type`](../metadata.md#type) must be the same as
144+
the latest known submitted document's [`type`](../metadata.md#type) for that [`id`](../metadata.md#id).
132145

133146
### [`ref`](../metadata.md#ref)
134147

docs/src/architecture/08_concepts/signed_doc/docs/contest_delegation.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,13 @@ timestamp of when the document was created.
147147

148148
#### [`id`](../metadata.md#id) Validation
149149

150-
IF [`ver`](../metadata.md#ver) does not == [`id`](../metadata.md#id) then a document with
151-
[`id`](../metadata.md#id) and [`ver`](../metadata.md#ver) being equal *MUST* exist.
150+
The document ID validation is performed based on timestamp thresholds:
151+
152+
* If `future_threshold` is configured,
153+
the document [`id`](../metadata.md#id) cannot be too far in the future from the
154+
current time.
155+
* If `past_threshold` is configured, the document [`id`](../metadata.md#id) cannot be too far in the past from the
156+
current time.
152157

153158
### [`ver`](../metadata.md#ver)
154159

@@ -165,7 +170,15 @@ The first version of the document must set [`ver`](../metadata.md#ver) == [`id`]
165170

166171
#### [`ver`](../metadata.md#ver) Validation
167172

168-
The document version must always be >= the document ID.
173+
1. The document version must always be >= the document ID.
174+
2. IF [`ver`](../metadata.md#ver) does not == [`id`](../metadata.md#id)
175+
then a document with [`id`](../metadata.md#id) and [`ver`](../metadata.md#ver) being equal *MUST* exist.
176+
3. When a document with the same [`id`](../metadata.md#id) already exists,
177+
the new document's [`ver`](../metadata.md#ver) must be greater than
178+
the latest known submitted version for that [`id`](../metadata.md#id).
179+
4. When a document with the same [`id`](../metadata.md#id) already exists,
180+
the new document's [`type`](../metadata.md#type) must be the same as
181+
the latest known submitted document's [`type`](../metadata.md#type) for that [`id`](../metadata.md#id).
169182

170183
### [`ref`](../metadata.md#ref)
171184

0 commit comments

Comments
 (0)