Spec_bounds rows for split login DTOs
Browse files at this commit612a8841f88d2c43651eb5d52ca36327ed6457a0Parent: 2d278c6- test
- spec_bounds rows for split login DTOs
2 changed files +43 -7
- README.md +1 -1
- tests/spec_bounds.rs +42 -6
README.mdmodified+1 -1
| @@ -649,7 +649,7 @@ drift from it**, which is enforced rather than asked for: | |||
| 649 | and fails unless each one is either referenced by `src/web/limits.rs` or | 649 | and fails unless each one is either referenced by `src/web/limits.rs` or |
| 650 | listed as a deliberate exclusion *with a reason*. A new constant breaks the | 650 | listed as a deliberate exclusion *with a reason*. A new constant breaks the |
| 651 | suite until someone decides, consciously, whether clients need it. | 651 | suite until someone decides, consciously, whether clients need it. |
| 652 | -- `tests/spec_bounds.rs` builds the OpenAPI document, reads all 194 published | 652 | +- `tests/spec_bounds.rs` builds the OpenAPI document, reads all 200 published |
| 653 | bounds back out of the emitted JSON, and asserts each equals its constant. | 653 | bounds back out of the emitted JSON, and asserts each equals its constant. |
| 654 | This exists because utoipa's `#[schema(max_length = …)]` accepts a **literal | 654 | This exists because utoipa's `#[schema(max_length = …)]` accepts a **literal |
| 655 | only** — a `const` there does not compile — so the annotations are | 655 | only** — a `const` there does not compile — so the annotations are |
tests/spec_bounds.rsmodified+42 -6
| @@ -159,32 +159,68 @@ fn expectations() -> Vec<(&'static str, &'static str, &'static str, i64)> { | |||
| 159 | MAX_PASSWORD_LEN as i64, | 159 | MAX_PASSWORD_LEN as i64, |
| 160 | ), | 160 | ), |
| 161 | // --- auth / users / notes / messages --- | 161 | // --- auth / users / notes / messages --- |
| 162 | - ("Credentials", "school", "minLength", MIN_SLUG_LEN as i64), | ||
| 163 | - ("Credentials", "school", "maxLength", MAX_SLUG_LEN as i64), | ||
| 164 | ( | 162 | ( |
| 165 | - "Credentials", | 163 | + "RegisterCredentials", |
| 164 | + "school", | ||
| 165 | + "minLength", | ||
| 166 | + MIN_SLUG_LEN as i64, | ||
| 167 | + ), | ||
| 168 | + ( | ||
| 169 | + "RegisterCredentials", | ||
| 170 | + "school", | ||
| 171 | + "maxLength", | ||
| 172 | + MAX_SLUG_LEN as i64, | ||
| 173 | + ), | ||
| 174 | + ( | ||
| 175 | + "RegisterCredentials", | ||
| 176 | + "username", | ||
| 177 | + "minLength", | ||
| 178 | + MIN_USERNAME_LEN as i64, | ||
| 179 | + ), | ||
| 180 | + ( | ||
| 181 | + "RegisterCredentials", | ||
| 182 | + "username", | ||
| 183 | + "maxLength", | ||
| 184 | + MAX_USERNAME_LEN as i64, | ||
| 185 | + ), | ||
| 186 | + ( | ||
| 187 | + "RegisterCredentials", | ||
| 188 | + "password", | ||
| 189 | + "minLength", | ||
| 190 | + MIN_PASSWORD_LEN as i64, | ||
| 191 | + ), | ||
| 192 | + ( | ||
| 193 | + "RegisterCredentials", | ||
| 194 | + "password", | ||
| 195 | + "maxLength", | ||
| 196 | + MAX_PASSWORD_LEN as i64, | ||
| 197 | + ), | ||
| 198 | + ( | ||
| 199 | + "LoginCredentials", | ||
| 166 | "username", | 200 | "username", |
| 167 | "minLength", | 201 | "minLength", |
| 168 | MIN_USERNAME_LEN as i64, | 202 | MIN_USERNAME_LEN as i64, |
| 169 | ), | 203 | ), |
| 170 | ( | 204 | ( |
| 171 | - "Credentials", | 205 | + "LoginCredentials", |
| 172 | "username", | 206 | "username", |
| 173 | "maxLength", | 207 | "maxLength", |
| 174 | MAX_USERNAME_LEN as i64, | 208 | MAX_USERNAME_LEN as i64, |
| 175 | ), | 209 | ), |
| 176 | ( | 210 | ( |
| 177 | - "Credentials", | 211 | + "LoginCredentials", |
| 178 | "password", | 212 | "password", |
| 179 | "minLength", | 213 | "minLength", |
| 180 | MIN_PASSWORD_LEN as i64, | 214 | MIN_PASSWORD_LEN as i64, |
| 181 | ), | 215 | ), |
| 182 | ( | 216 | ( |
| 183 | - "Credentials", | 217 | + "LoginCredentials", |
| 184 | "password", | 218 | "password", |
| 185 | "maxLength", | 219 | "maxLength", |
| 186 | MAX_PASSWORD_LEN as i64, | 220 | MAX_PASSWORD_LEN as i64, |
| 187 | ), | 221 | ), |
| 222 | + ("SelectSchool", "school", "minLength", MIN_SLUG_LEN as i64), | ||
| 223 | + ("SelectSchool", "school", "maxLength", MAX_SLUG_LEN as i64), | ||
| 188 | ("UpdateProfile", "name", "maxLength", MAX_NAME_LEN as i64), | 224 | ("UpdateProfile", "name", "maxLength", MAX_NAME_LEN as i64), |
| 189 | ("UpdateProfile", "surname", "maxLength", MAX_NAME_LEN as i64), | 225 | ("UpdateProfile", "surname", "maxLength", MAX_NAME_LEN as i64), |
| 190 | ("UpdateProfile", "email", "maxLength", MAX_EMAIL_LEN as i64), | 226 | ("UpdateProfile", "email", "maxLength", MAX_EMAIL_LEN as i64), |