encoding/jsonschema: constraints don't imply types

This was a major bug based on the wrong assumption that
a JSON Schema constraint implies the type for that constraint.
Instead, the contraints only apply if a value is of a certain
type.

To keep diffs to a minimum, and to improve the overal output,
it now explicitly sorts literal
composit types (structs and lists) at the end of a series
of conjunctions.

Change-Id: Ice98a2bc00ae4a68170cd6cd726565a453b1187f
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/6302
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
diff --git a/encoding/jsonschema/testdata/emptyanyof.txtar b/encoding/jsonschema/testdata/emptyanyof.txtar
new file mode 100644
index 0000000..0313e6d
--- /dev/null
+++ b/encoding/jsonschema/testdata/emptyanyof.txtar
@@ -0,0 +1,26 @@
+-- emptyanyof.json --
+{
+ "$defs": {
+   "shell": {
+      "description": "Specify a shell.",
+      "type": "string",
+      "anyOf": [
+        {
+        },
+        {
+          "enum": [
+            "bash",
+            "sh",
+            "cmd",
+            "powershell"
+          ]
+        }
+      ]
+   }
+ }
+}
+
+-- out.cue --
+_
+
+#shell: (string | ("bash" | "sh" | "cmd" | "powershell")) & string