Commit aa1b685
Small (mostly) backwards compatible quality of life changes (#65)
* Small (mostly) backwards compatible quality of life changes
- Fixes an issue where multiple versions or views could map to the same identifier, which would result in them overwriting each other.
- You now have to explicitly mark a version of a validation as an empty object. This solves an issue where you could succesfully validate constructables with a nil version by passing in an empty object.
- view and version can now directly be called on the validator instead of having to call to_constructable.
- Validating a media type which doesn't have a validation now throws an error instead of accepting an empty object.
- Added available_validations function on validator which returns a list of constructable it supports.
- Added name DSL function to replace media_type. name allows using self.organisation instead of having to define self.base_format. name defaults to using an opinionated media type identifier format. Name now only allows setting a default suffix as having a default version caused subtle bugs during real world usage.
- Added identfier_format function to override opinionated media type identifier format.
- Added identifier function to get the media type identifier1 parent 563e3b2 commit aa1b685
File tree
22 files changed
+498
-194
lines changed- lib
- media_types
- test/media_types
- dsl
22 files changed
+498
-194
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
1 | 14 | | |
2 | 15 | | |
3 | 16 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
| |||
24 | 26 | | |
25 | 27 | | |
26 | 28 | | |
27 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
28 | 41 | | |
29 | | - | |
30 | | - | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
31 | 48 | | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
36 | 56 | | |
37 | 57 | | |
38 | 58 | | |
39 | 59 | | |
40 | 60 | | |
41 | 61 | | |
42 | 62 | | |
43 | | - | |
44 | | - | |
| 63 | + | |
| 64 | + | |
45 | 65 | | |
46 | 66 | | |
47 | | - | |
| 67 | + | |
48 | 68 | | |
49 | 69 | | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
56 | 77 | | |
57 | | - | |
58 | | - | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
59 | 81 | | |
60 | 82 | | |
61 | 83 | | |
| |||
97 | 119 | | |
98 | 120 | | |
99 | 121 | | |
100 | | - | |
| 122 | + | |
101 | 123 | | |
102 | 124 | | |
103 | 125 | | |
| |||
315 | 337 | | |
316 | 338 | | |
317 | 339 | | |
318 | | - | |
| 340 | + | |
319 | 341 | | |
320 | 342 | | |
321 | | - | |
| 343 | + | |
322 | 344 | | |
323 | 345 | | |
324 | | - | |
| 346 | + | |
325 | 347 | | |
326 | 348 | | |
327 | | - | |
| 349 | + | |
328 | 350 | | |
329 | 351 | | |
330 | 352 | | |
331 | 353 | | |
332 | 354 | | |
333 | | - | |
| 355 | + | |
334 | 356 | | |
335 | 357 | | |
336 | | - | |
| 358 | + | |
337 | 359 | | |
338 | 360 | | |
339 | 361 | | |
| |||
374 | 396 | | |
375 | 397 | | |
376 | 398 | | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
377 | 457 | | |
378 | 458 | | |
379 | 459 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
15 | 28 | | |
16 | 29 | | |
17 | 30 | | |
Binary file not shown.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
76 | 80 | | |
77 | | - | |
| 81 | + | |
78 | 82 | | |
79 | 83 | | |
80 | 84 | | |
81 | | - | |
82 | 85 | | |
83 | 86 | | |
84 | | - | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
85 | 93 | | |
86 | 94 | | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
87 | 100 | | |
88 | 101 | | |
89 | | - | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
90 | 105 | | |
91 | 106 | | |
92 | 107 | | |
93 | 108 | | |
94 | 109 | | |
95 | 110 | | |
96 | 111 | | |
97 | | - | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
98 | 115 | | |
99 | 116 | | |
100 | 117 | | |
101 | 118 | | |
102 | 119 | | |
103 | 120 | | |
104 | 121 | | |
| 122 | + | |
| 123 | + | |
105 | 124 | | |
106 | 125 | | |
107 | 126 | | |
108 | 127 | | |
109 | 128 | | |
| 129 | + | |
110 | 130 | | |
111 | 131 | | |
112 | 132 | | |
| |||
0 commit comments