@sdboyer/thema-ui 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (225) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +25 -2
  3. package/dist/Diagnostics.d.ts +8 -0
  4. package/dist/Diagnostics.js +14 -0
  5. package/dist/Editor.d.ts +12 -0
  6. package/dist/Editor.js +95 -0
  7. package/dist/OpBar.d.ts +14 -0
  8. package/dist/OpBar.js +15 -0
  9. package/dist/Output.d.ts +20 -0
  10. package/dist/Output.js +56 -0
  11. package/dist/Tabs.d.ts +15 -0
  12. package/dist/Tabs.js +23 -0
  13. package/dist/cue-lang.d.ts +8 -0
  14. package/dist/cue-lang.js +82 -0
  15. package/dist/docs.d.ts +64 -0
  16. package/dist/docs.js +42 -0
  17. package/dist/index.d.ts +12 -0
  18. package/dist/index.js +18 -0
  19. package/dist/markers.d.ts +11 -0
  20. package/dist/markers.js +45 -0
  21. package/dist/ops.d.ts +13 -0
  22. package/dist/ops.js +22 -0
  23. package/dist/positions.d.ts +7 -0
  24. package/dist/positions.js +40 -0
  25. package/dist/theme.d.ts +16 -0
  26. package/dist/theme.js +55 -0
  27. package/dist/types.d.ts +580 -0
  28. package/dist/types.js +85 -0
  29. package/errors/E0101.md +43 -0
  30. package/errors/E0102.md +34 -0
  31. package/errors/E0103.md +41 -0
  32. package/errors/E0104.md +5 -0
  33. package/errors/E0105.md +62 -0
  34. package/errors/E0106.md +46 -0
  35. package/errors/E0107.md +48 -0
  36. package/errors/E0108.md +45 -0
  37. package/errors/E0109.md +37 -0
  38. package/errors/E0110.md +17 -0
  39. package/errors/E0111.md +55 -0
  40. package/errors/E0112.md +40 -0
  41. package/errors/E0120.md +34 -0
  42. package/errors/E0121.md +34 -0
  43. package/errors/E0122.md +26 -0
  44. package/errors/E0123.md +37 -0
  45. package/errors/E0124.md +36 -0
  46. package/errors/E0125.md +43 -0
  47. package/errors/E0126.md +38 -0
  48. package/errors/E0128.md +34 -0
  49. package/errors/E0129.md +42 -0
  50. package/errors/E0130.md +43 -0
  51. package/errors/E0131.md +42 -0
  52. package/errors/E0132.md +40 -0
  53. package/errors/E0133.md +46 -0
  54. package/errors/E0134.md +36 -0
  55. package/errors/E0135.md +109 -0
  56. package/errors/E0137.md +37 -0
  57. package/errors/E0140.md +46 -0
  58. package/errors/E0141.md +35 -0
  59. package/errors/E0142.md +38 -0
  60. package/errors/E0143.md +62 -0
  61. package/errors/E0144.md +49 -0
  62. package/errors/E0145.md +48 -0
  63. package/errors/E0146.md +38 -0
  64. package/errors/E0147.md +57 -0
  65. package/errors/E0148.md +42 -0
  66. package/errors/E0149.md +27 -0
  67. package/errors/E0150.md +77 -0
  68. package/errors/E0151.md +47 -0
  69. package/errors/E0152.md +35 -0
  70. package/errors/E0201.md +35 -0
  71. package/errors/E0202.md +42 -0
  72. package/errors/E0203.md +37 -0
  73. package/errors/E0204.md +46 -0
  74. package/errors/E0205.md +47 -0
  75. package/errors/E0206.md +47 -0
  76. package/errors/E0208.md +59 -0
  77. package/errors/E0210.md +44 -0
  78. package/errors/E0211.md +43 -0
  79. package/errors/E0212.md +41 -0
  80. package/errors/E0213.md +42 -0
  81. package/errors/E0214.md +42 -0
  82. package/errors/E0215.md +44 -0
  83. package/errors/E0216.md +41 -0
  84. package/errors/E0217.md +43 -0
  85. package/errors/E0218.md +44 -0
  86. package/errors/E0230.md +46 -0
  87. package/errors/E0232.md +42 -0
  88. package/errors/E0233.md +42 -0
  89. package/errors/E0234.md +43 -0
  90. package/errors/E0240.md +31 -0
  91. package/errors/E0242.md +5 -0
  92. package/errors/E0243.md +5 -0
  93. package/errors/E0250.md +39 -0
  94. package/errors/E0251.md +83 -0
  95. package/errors/E0252.md +42 -0
  96. package/errors/E0253.md +142 -0
  97. package/errors/E0254.md +38 -0
  98. package/errors/E0301.md +43 -0
  99. package/errors/E0302.md +58 -0
  100. package/errors/E0303.md +57 -0
  101. package/errors/E0304.md +9 -0
  102. package/errors/E0305.md +55 -0
  103. package/errors/E0307.md +9 -0
  104. package/errors/E0308.md +9 -0
  105. package/errors/E0310.md +46 -0
  106. package/errors/E0311.md +46 -0
  107. package/errors/E0330.md +67 -0
  108. package/errors/E0331.md +64 -0
  109. package/errors/E0332.md +52 -0
  110. package/errors/E0333.md +61 -0
  111. package/errors/E0334.md +61 -0
  112. package/errors/E0335.md +57 -0
  113. package/errors/E0336.md +50 -0
  114. package/errors/E0337.md +54 -0
  115. package/errors/E0338.md +62 -0
  116. package/errors/E0340.md +57 -0
  117. package/errors/E0341.md +51 -0
  118. package/errors/E0342.md +53 -0
  119. package/errors/E0343.md +56 -0
  120. package/errors/E0344.md +58 -0
  121. package/errors/E0345.md +51 -0
  122. package/errors/E0346.md +45 -0
  123. package/errors/E0347.md +53 -0
  124. package/errors/E0348.md +50 -0
  125. package/errors/E0349.md +52 -0
  126. package/errors/E0350.md +54 -0
  127. package/errors/E0351.md +54 -0
  128. package/errors/E0352.md +60 -0
  129. package/errors/E0353.md +53 -0
  130. package/errors/E0354.md +43 -0
  131. package/errors/E0355.md +55 -0
  132. package/errors/E0356.md +65 -0
  133. package/errors/E0357.md +68 -0
  134. package/errors/E0358.md +50 -0
  135. package/errors/E0359.md +53 -0
  136. package/errors/E0360.md +59 -0
  137. package/errors/E0361.md +59 -0
  138. package/errors/E0362.md +56 -0
  139. package/errors/E0364.md +58 -0
  140. package/errors/E0365.md +58 -0
  141. package/errors/E0366.md +56 -0
  142. package/errors/E0367.md +57 -0
  143. package/errors/E0368.md +58 -0
  144. package/errors/E0369.md +60 -0
  145. package/errors/E0370.md +59 -0
  146. package/errors/E0371.md +59 -0
  147. package/errors/E0372.md +57 -0
  148. package/errors/E0380.md +71 -0
  149. package/errors/E0381.md +61 -0
  150. package/errors/E0382.md +64 -0
  151. package/errors/E0383.md +61 -0
  152. package/errors/E0384.md +63 -0
  153. package/errors/E0385.md +61 -0
  154. package/errors/E0386.md +59 -0
  155. package/errors/E0387.md +59 -0
  156. package/errors/E0388.md +60 -0
  157. package/errors/E0389.md +59 -0
  158. package/errors/E0390.md +59 -0
  159. package/errors/E0401.md +56 -0
  160. package/errors/E0402.md +51 -0
  161. package/errors/E0403.md +51 -0
  162. package/errors/E0404.md +57 -0
  163. package/errors/E0405.md +56 -0
  164. package/errors/E0406.md +53 -0
  165. package/errors/E0407.md +54 -0
  166. package/errors/E0410.md +56 -0
  167. package/errors/E0411.md +59 -0
  168. package/errors/E0412.md +59 -0
  169. package/errors/E0413.md +74 -0
  170. package/errors/E0414.md +53 -0
  171. package/errors/E0415.md +72 -0
  172. package/errors/E0416.md +67 -0
  173. package/errors/E0418.md +59 -0
  174. package/errors/E0420.md +71 -0
  175. package/errors/E0421.md +82 -0
  176. package/errors/E0422.md +82 -0
  177. package/errors/E0423.md +83 -0
  178. package/errors/E0501.md +51 -0
  179. package/errors/E0502.md +50 -0
  180. package/errors/E0503.md +52 -0
  181. package/errors/E0504.md +64 -0
  182. package/errors/E0505.md +51 -0
  183. package/errors/E0506.md +48 -0
  184. package/errors/E0507.md +41 -0
  185. package/errors/E0508.md +39 -0
  186. package/errors/E0601.md +22 -0
  187. package/errors/E0602.md +28 -0
  188. package/errors/E0603.md +65 -0
  189. package/errors/E0604.md +37 -0
  190. package/errors/E0605.md +36 -0
  191. package/errors/E0606.md +44 -0
  192. package/errors/E0607.md +57 -0
  193. package/errors/E0608.md +37 -0
  194. package/errors/E0609.md +33 -0
  195. package/errors/E0611.md +37 -0
  196. package/errors/E0612.md +34 -0
  197. package/errors/E0613.md +30 -0
  198. package/errors/E0614.md +36 -0
  199. package/errors/E0616.md +33 -0
  200. package/errors/E0617.md +15 -0
  201. package/errors/E0618.md +16 -0
  202. package/errors/E0620.md +37 -0
  203. package/errors/E0621.md +45 -0
  204. package/errors/E0622.md +34 -0
  205. package/errors/E0623.md +33 -0
  206. package/errors/E0624.md +34 -0
  207. package/errors/E0625.md +28 -0
  208. package/errors/E0626.md +54 -0
  209. package/errors/E0627.md +27 -0
  210. package/errors/E0628.md +63 -0
  211. package/errors/E0701.md +25 -0
  212. package/errors/E0801.md +23 -0
  213. package/errors/E0802.md +22 -0
  214. package/errors/E0803.md +22 -0
  215. package/errors/E0804.md +25 -0
  216. package/errors/E0805.md +26 -0
  217. package/errors/E0901.md +27 -0
  218. package/errors/E0902.md +40 -0
  219. package/errors/E0903.md +23 -0
  220. package/errors/E1001.md +53 -0
  221. package/errors/E1002.md +43 -0
  222. package/errors/E1003.md +40 -0
  223. package/errors/E1004.md +44 -0
  224. package/errors/README.md +215 -0
  225. package/package.json +34 -4
@@ -0,0 +1,48 @@
1
+ <!-- Generated by go test ./diag; do not edit. -->
2
+
3
+ # E0145: a lens refers to another lens of the lineage
4
+
5
+ A lens reads a hidden field of another lens through the lineage (reference
6
+ rule ref-lens-to-lens). Each lens declares what it needs.
7
+
8
+ ## Example
9
+
10
+ `lineage.cue`:
11
+
12
+ ```cue
13
+ lin: {
14
+ name: "ship"
15
+ schemas: {
16
+ "0": "0": {
17
+ schema: {a: string}
18
+ }
19
+ "1": "0": {
20
+ schema: {b: string}
21
+ }
22
+ }
23
+ lenses: {
24
+ "1.0->0.0": {
25
+ v1_0: _
26
+ _fallback: "x"
27
+ v0_0: {a: v1_0.b}
28
+ }
29
+ "0.0->1.0": {
30
+ v0_0: _
31
+ v1_0: {b: lin.lenses["1.0->0.0"]._fallback}
32
+ }
33
+ }
34
+ }
35
+ ```
36
+
37
+ thema reports:
38
+
39
+ ```
40
+ error[E0145]: v1_0.b in lens 0.0->1.0 refers to lenses["1.0->0.0"]._fallback, another lens
41
+ --> lineage.cue:19:14
42
+ |
43
+ 19 | v1_0: {b: lin.lenses["1.0->0.0"]._fallback}
44
+ | ^^^
45
+ |
46
+ = note: reference rule ref-lens-to-lens
47
+ = help: a lens may refer only to v0_0, the instance it takes, its own body and CUE's builtin packages
48
+ ```
@@ -0,0 +1,38 @@
1
+ <!-- Generated by go test ./diag; do not edit. -->
2
+
3
+ # E0146: a reference cannot be resolved statically
4
+
5
+ A schema selects a field of the lineage by a label only an instance decides.
6
+ CUE leaves the selection pending, and thema cannot tell from the schema what
7
+ the reference denotes (reference rule ref-unresolved). Written with constant
8
+ labels it would be a reference thema can judge (a label the evaluator can
9
+ fold, such as lin["na"+"me"], already is: it resolves to lin.name); either
10
+ way, the schema writes the literal it wants.
11
+
12
+ ## Example
13
+
14
+ `lineage.cue`:
15
+
16
+ ```cue
17
+ lin: {
18
+ name: "ship"
19
+ schemas: {
20
+ "0": "0": {
21
+ schema: {a: string, n: lin[a]}
22
+ }
23
+ }
24
+ }
25
+ ```
26
+
27
+ thema reports:
28
+
29
+ ```
30
+ error[E0146]: n in schema 0.0 refers to the lineage[...], which thema cannot resolve statically
31
+ --> lineage.cue:5:27
32
+ |
33
+ 5 | schema: {a: string, n: lin[a]}
34
+ | ^^^
35
+ |
36
+ = note: reference rule ref-unresolved
37
+ = help: write the reference with constant labels, or declare what it needs inside the schema
38
+ ```
@@ -0,0 +1,57 @@
1
+ <!-- Generated by go test ./diag; do not edit. -->
2
+
3
+ # E0147: a version file imports a package its Schema does not use
4
+
5
+ A version file's imports serve its Schema. A lens calls the strings functions
6
+ without an import, so an import the Schema does not use has no purpose.
7
+
8
+ ## Example
9
+
10
+ `ship/history/0.0.thema`:
11
+
12
+ ```cue
13
+ Schema: {
14
+ name: string
15
+ }
16
+ ```
17
+
18
+ `ship/history/1.0.thema`:
19
+
20
+ ```cue
21
+ import "strings"
22
+
23
+ Schema: {
24
+ name: string
25
+ label: string
26
+ }
27
+
28
+ ForwardLens: {
29
+ v0_0: _
30
+ v1_0: {
31
+ label: strings.ToUpper(v0_0.name)
32
+ }
33
+ }
34
+ ```
35
+
36
+ `ship/tip.thema`:
37
+
38
+ ```cue
39
+ import "strings"
40
+
41
+ Schema: {
42
+ name: string
43
+ label: string
44
+ }
45
+ ```
46
+
47
+ thema reports:
48
+
49
+ ```
50
+ error[E0147]: history/1.0.thema imports strings, which its Schema does not use
51
+ --> history/1.0.thema:1:8
52
+ |
53
+ 1 | import "strings"
54
+ | ^^^^^^^^^
55
+ |
56
+ = help: remove the import: a lens calls the strings functions without one
57
+ ```
@@ -0,0 +1,42 @@
1
+ <!-- Generated by go test ./diag; do not edit. -->
2
+
3
+ # E0148: a numbered version file is at the top of the lineage's directory, not under history/
4
+
5
+ A numbered version file sits at the top of the lineage's directory. The top
6
+ holds only the tip, `tip.thema`, whose version is derived rather than written;
7
+ numbered versions are frozen, and live under `history/`.
8
+
9
+ ## Example
10
+
11
+ `ship/history/0.0.thema`:
12
+
13
+ ```cue
14
+ Schema: {
15
+ a: string
16
+ }
17
+ ```
18
+
19
+ `ship/1.0.thema`:
20
+
21
+ ```cue
22
+ Schema: {
23
+ b: string
24
+ }
25
+ ```
26
+
27
+ `ship/tip.thema`:
28
+
29
+ ```cue
30
+ Schema: {
31
+ b: string
32
+ }
33
+ ```
34
+
35
+ thema reports:
36
+
37
+ ```
38
+ error[E0148]: 1.0.thema is a numbered version at the top of the lineage's directory
39
+ |
40
+ = note: the top of the lineage's directory holds only the tip, tip.thema; numbered versions are frozen, and live under history/
41
+ = help: move it to history/1.0.thema
42
+ ```
@@ -0,0 +1,27 @@
1
+ <!-- Generated by go test ./diag; do not edit. -->
2
+
3
+ # E0149: the lineage's directory has no tip.thema
4
+
5
+ The lineage has no `tip.thema`. The tip is the version being worked on, and is
6
+ always present: after a cut it equals the newest version under `history/`. The
7
+ development path, which binds the tip, and the clean check, which compares it
8
+ with the history, need it; binding the history alone does not read it.
9
+
10
+ ## Example
11
+
12
+ `ship/history/0.0.thema`:
13
+
14
+ ```cue
15
+ Schema: {
16
+ a: string
17
+ }
18
+ ```
19
+
20
+ thema reports:
21
+
22
+ ```
23
+ error[E0149]: the lineage has no tip.thema
24
+ |
25
+ = note: the tip is the version being worked on, and is always present: after a cut it equals the newest version in history/
26
+ = help: add tip.thema, starting from a copy of the newest version's Schema
27
+ ```
@@ -0,0 +1,77 @@
1
+ <!-- Generated by go test ./diag; do not edit. -->
2
+
3
+ # E0150: a lens of the tip names a version other than the tip's parent, the newest version under history/
4
+
5
+ A lens of the tip connects it to its parent, the newest version under
6
+ `history/`, and names the parent's instance after that version. Here the
7
+ `ForwardLens` was written when the newest version was 1.0, and then 1.1 was
8
+ cut beneath it, as happens when the tip's branch is rebased onto one that cut
9
+ a version. The lens still names `v1_0`, so it no longer connects the tip to its
10
+ parent. Renaming the parameter is not enough on its own: the mappings were
11
+ written against 1.0's schema, and need review against 1.1's.
12
+
13
+ ## Example
14
+
15
+ `ship/history/0.0.thema`:
16
+
17
+ ```cue
18
+ Schema: {
19
+ a: string
20
+ }
21
+ ```
22
+
23
+ `ship/history/1.0.thema`:
24
+
25
+ ```cue
26
+ Schema: {
27
+ a: string
28
+ b: int
29
+ }
30
+
31
+ ForwardLens: {
32
+ v0_0: _
33
+ v1_0: {
34
+ b: 0
35
+ }
36
+ }
37
+ ```
38
+
39
+ `ship/history/1.1.thema`:
40
+
41
+ ```cue
42
+ Schema: {
43
+ a: string
44
+ b: int
45
+ c?: string
46
+ }
47
+ ```
48
+
49
+ `ship/tip.thema`:
50
+
51
+ ```cue
52
+ Schema: {
53
+ a: string
54
+ b: int
55
+ d: bool
56
+ }
57
+
58
+ ForwardLens: {
59
+ v1_0: _
60
+ tip: {
61
+ d: false
62
+ }
63
+ }
64
+ ```
65
+
66
+ thema reports:
67
+
68
+ ```
69
+ error[E0150]: ForwardLens in tip.thema names v1_0, but the tip's parent is 1.1
70
+ --> tip.thema:8:2
71
+ |
72
+ 8 | v1_0: _
73
+ | ^^^^
74
+ |
75
+ = note: the lens was written against an older parent, 1.0; the newest version under history/ is now 1.1, history/1.1.thema
76
+ = help: declare v1_1: _ in place of v1_0, and review the mappings against 1.1's schema
77
+ ```
@@ -0,0 +1,47 @@
1
+ <!-- Generated by go test ./diag; do not edit. -->
2
+
3
+ # E0151: a schema or lens declares a hidden field or a hidden definition
4
+
5
+ A version's ID is computed over its schema and lenses, and must be the same
6
+ however the lineage is loaded. CUE scopes a hidden field (_x) or a hidden
7
+ definition (_#X) to the package it is declared in, and writes its name
8
+ qualified by that package wherever the value is used outside it: the same
9
+ schema would hash one way compiled from its version files, another loaded as
10
+ a package, and another imported (#250). So a schema, the joinSchema, and the
11
+ input, result and lacunas of a lens declare neither. A helper in a schema is a
12
+ definition (#X) or a let; a lens in the normal form keeps its scratch in hidden
13
+ fields beside its input and result: its ID covers the values its result reads
14
+ from them, but not their names.
15
+
16
+ ## Example
17
+
18
+ `ship/history/0.0.thema`:
19
+
20
+ ```cue
21
+ Schema: {
22
+ _limit: 10
23
+ count: int & <=_limit
24
+ }
25
+ ```
26
+
27
+ `ship/tip.thema`:
28
+
29
+ ```cue
30
+ Schema: {
31
+ _limit: 10
32
+ count: int & <=_limit
33
+ }
34
+ ```
35
+
36
+ thema reports:
37
+
38
+ ```
39
+ error[E0151]: the schema in history/0.0.thema declares _limit, a hidden field
40
+ --> history/0.0.thema:2:2
41
+ |
42
+ 2 | _limit: 10
43
+ | ^^^^^^
44
+ |
45
+ = note: a version's ID must not depend on how its lineage is loaded, and how CUE writes a hidden name depends on the package the lineage was loaded through (#250)
46
+ = help: write a helper as a definition or a let instead; to declare a data field whose name starts with _, quote it: "_limit"
47
+ ```
@@ -0,0 +1,35 @@
1
+ <!-- Generated by go test ./diag; do not edit. -->
2
+
3
+ # E0152: the value a lineage is bound from is not the root of a value CUE built from source
4
+
5
+ A lineage compiled on its own is filled into a larger value with `FillPath`
6
+ and bound from there. The result is a value built in Go: CUE keeps no build
7
+ instance for it, so bind cannot tell the lineage's own declarations from the
8
+ value around it, and refuses it. `thema.Compose` writes the lineage into the
9
+ larger value's package as a file instead, and the package loaded from those
10
+ files binds. A field of a loaded package, passed instead of the package's
11
+ root and the path to the field, is refused the same way.
12
+
13
+ ## Example
14
+
15
+ `holder.cue`:
16
+
17
+ ```cue
18
+ lineages: ship: _
19
+ ```
20
+
21
+ `lineage.cue`:
22
+
23
+ ```cue
24
+ name: "ship"
25
+ schemas: "0": "0": schema: {a?: string}
26
+ ```
27
+
28
+ thema reports:
29
+
30
+ ```
31
+ error[E0152]: a lineage is bound from the root of a value CUE built from source, and this root was built in Go
32
+ |
33
+ = note: bind tells the lineage's own declarations from the CUE around it by the build instance of the root it is bound from, and a value made by FillPath or Unify has none
34
+ = help: compose separately built lineages into one package with thema.Compose, load it, and bind each lineage from that package's root
35
+ ```
@@ -0,0 +1,35 @@
1
+ <!-- Generated by go test ./diag; do not edit. -->
2
+
3
+ # E0201: the first schema is not version 0.0
4
+
5
+ Every lineage starts at version 0.0. Versions are contiguous from there, so a
6
+ lineage whose first schema is any other version has a gap before it.
7
+
8
+ ## Example
9
+
10
+ `lineage.cue`:
11
+
12
+ ```cue
13
+ name: "ship"
14
+ schemas: {
15
+ "1": {
16
+ "0": {
17
+ schema: {
18
+ a: string
19
+ }
20
+ }
21
+ }
22
+ }
23
+ ```
24
+
25
+ thema reports:
26
+
27
+ ```
28
+ error[E0201]: the first schema is version 1.0, not 0.0
29
+ --> lineage.cue:4:3
30
+ |
31
+ 4 | "0": {
32
+ | ^^^
33
+ |
34
+ = help: every lineage starts at version 0.0
35
+ ```
@@ -0,0 +1,42 @@
1
+ <!-- Generated by go test ./diag; do not edit. -->
2
+
3
+ # E0202: a schema's version does not follow its predecessor's
4
+
5
+ Versions are contiguous: each schema is the next minor version of its
6
+ predecessor, or the first version of the next major. A skipped version would be
7
+ a version with no schema.
8
+
9
+ ## Example
10
+
11
+ `lineage.cue`:
12
+
13
+ ```cue
14
+ name: "ship"
15
+ schemas: {
16
+ "0": {
17
+ "0": {
18
+ schema: {
19
+ a: string
20
+ }
21
+ }
22
+ "2": {
23
+ schema: {
24
+ a: string
25
+ b?: int
26
+ }
27
+ }
28
+ }
29
+ }
30
+ ```
31
+
32
+ thema reports:
33
+
34
+ ```
35
+ error[E0202]: schema version 0.2 does not follow 0.0
36
+ --> lineage.cue:9:3
37
+ |
38
+ 9 | "2": {
39
+ | ^^^
40
+ |
41
+ = help: the next schema after 0.0 is version 0.1 or 1.0
42
+ ```
@@ -0,0 +1,37 @@
1
+ <!-- Generated by go test ./diag; do not edit. -->
2
+
3
+ # E0203: a major version declares no schemas
4
+
5
+ A major version is a group of minor versions, keyed by minor version; its first
6
+ schema is version N.0. A major version key with nothing under it declares no
7
+ schema at all.
8
+
9
+ ## Example
10
+
11
+ `lineage.cue`:
12
+
13
+ ```cue
14
+ name: "ship"
15
+ schemas: {
16
+ "0": {
17
+ "0": {
18
+ schema: {
19
+ a: string
20
+ }
21
+ }
22
+ }
23
+ "1": {}
24
+ }
25
+ ```
26
+
27
+ thema reports:
28
+
29
+ ```
30
+ error[E0203]: major version 1 declares no schemas
31
+ --> lineage.cue:10:2
32
+ |
33
+ 10 | "1": {}
34
+ | ^^^
35
+ |
36
+ = help: declare its first schema as version 1.0
37
+ ```
@@ -0,0 +1,46 @@
1
+ <!-- Generated by go test ./diag; do not edit. -->
2
+
3
+ # E0204: two version files declare the same version
4
+
5
+ A version has one file. Two files at the same path, `history/0.0.thema`, can
6
+ only reach the compiler through its API, as in a playground request, and
7
+ would be two schemas for one version.
8
+
9
+ ## Example
10
+
11
+ `ship/history/0.0.thema`:
12
+
13
+ ```cue
14
+ Schema: {
15
+ a: string
16
+ }
17
+ ```
18
+
19
+ `ship/history/0.0.thema`:
20
+
21
+ ```cue
22
+ Schema: {
23
+ a: string
24
+ }
25
+ ```
26
+
27
+ `ship/tip.thema`:
28
+
29
+ ```cue
30
+ Schema: {
31
+ a: string
32
+ }
33
+ ```
34
+
35
+ thema reports:
36
+
37
+ ```
38
+ error[E0204]: history/0.0.thema and history/0.0.thema both declare version 0.0
39
+ --> history/0.0.thema:1:1
40
+ |
41
+ 1 | Schema: {
42
+ | ^^^^^^
43
+ | ------ the other is here
44
+ |
45
+ = help: a version has one file, under history/
46
+ ```
@@ -0,0 +1,47 @@
1
+ <!-- Generated by go test ./diag; do not edit. -->
2
+
3
+ # E0205: the version files skip a version
4
+
5
+ Versions are contiguous: each file is the next minor version of its
6
+ predecessor, or the first version of the next major. A gap would be a version
7
+ with no file.
8
+
9
+ ## Example
10
+
11
+ `ship/history/0.0.thema`:
12
+
13
+ ```cue
14
+ Schema: {
15
+ a: string
16
+ }
17
+ ```
18
+
19
+ `ship/history/0.2.thema`:
20
+
21
+ ```cue
22
+ Schema: {
23
+ a: string
24
+ b?: int
25
+ }
26
+ ```
27
+
28
+ `ship/tip.thema`:
29
+
30
+ ```cue
31
+ Schema: {
32
+ a: string
33
+ b?: int
34
+ }
35
+ ```
36
+
37
+ thema reports:
38
+
39
+ ```
40
+ error[E0205]: history/0.2.thema skips a version: after 0.0 comes 0.1
41
+ --> history/0.2.thema:1:1
42
+ |
43
+ 1 | Schema: {
44
+ | ^^^^^^
45
+ |
46
+ = help: rename the file history/0.1.thema, or add the versions between
47
+ ```
@@ -0,0 +1,47 @@
1
+ <!-- Generated by go test ./diag; do not edit. -->
2
+
3
+ # E0206: a version file named as a major version is backward compatible with its predecessor
4
+
5
+ Whether a version is major or minor is derived from the compatibility check,
6
+ and the file's name must agree. This file is named as a major version, but its
7
+ schema is backward compatible with its predecessor's, so it is a minor version.
8
+
9
+ ## Example
10
+
11
+ `ship/history/0.0.thema`:
12
+
13
+ ```cue
14
+ Schema: {
15
+ a: string
16
+ }
17
+ ```
18
+
19
+ `ship/history/1.0.thema`:
20
+
21
+ ```cue
22
+ Schema: {
23
+ a: string
24
+ b?: int
25
+ }
26
+ ```
27
+
28
+ `ship/tip.thema`:
29
+
30
+ ```cue
31
+ Schema: {
32
+ a: string
33
+ b?: int
34
+ }
35
+ ```
36
+
37
+ thema reports:
38
+
39
+ ```
40
+ error[E0206]: history/1.0.thema is backward compatible with 0.0, so it is minor version 0.1, not a major version
41
+ --> history/1.0.thema:1:1
42
+ |
43
+ 1 | Schema: {
44
+ | ^^^^^^
45
+ |
46
+ = help: rename the file history/0.1.thema, or make a breaking change
47
+ ```
@@ -0,0 +1,59 @@
1
+ <!-- Generated by go test ./diag; do not edit. -->
2
+
3
+ # E0208: a major version is backward compatible with its predecessor
4
+
5
+ A new major version is a breaking change: some instance of the predecessor is
6
+ not an instance of it. A schema declared as N.0 that is backward compatible
7
+ with its predecessor belongs under the previous major version, as its next
8
+ minor version.
9
+
10
+ ## Example
11
+
12
+ `lineage.cue`:
13
+
14
+ ```cue
15
+ name: "ship"
16
+ schemas: {
17
+ "0": {
18
+ "0": {
19
+ schema: {
20
+ a: string
21
+ }
22
+ }
23
+ }
24
+ "1": {
25
+ "0": {
26
+ schema: {
27
+ a: string
28
+ b?: int
29
+ }
30
+ }
31
+ }
32
+ }
33
+ lenses: {
34
+ "0.0->1.0": {
35
+ v0_0: _
36
+ v1_0: {
37
+ a: v0_0.a
38
+ }
39
+ }
40
+ "1.0->0.0": {
41
+ v1_0: _
42
+ v0_0: {
43
+ a: v1_0.a
44
+ }
45
+ }
46
+ }
47
+ ```
48
+
49
+ thema reports:
50
+
51
+ ```
52
+ error[E0208]: schema 1.0 is backward compatible with 0.0, so it is not a major version
53
+ --> lineage.cue:12:4
54
+ |
55
+ 12 | schema: {
56
+ | ^^^^^^
57
+ |
58
+ = help: declare it as version 0.1, or make a breaking change
59
+ ```