cue: add Value.Equals method

Also changed typos for != support for numbers.

Change-Id: I8bc34b50b7c87b31146cd89ea683a4182039b4e1
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/2641
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
diff --git a/encoding/openapi/build.go b/encoding/openapi/build.go
index d2315fa..568d643 100644
--- a/encoding/openapi/build.go
+++ b/encoding/openapi/build.go
@@ -576,10 +576,6 @@
 	// Type may be number of float.
 
 	switch op, a := v.Expr(); op {
-	// TODO: support the following JSON schema constraints
-	// - multipleOf
-	// setIntConstraint(t, "multipleOf", a)
-
 	case cue.LessThanOp:
 		b.setFilter("Schema", "exclusiveMaximum", b.big(a[0]))
 
@@ -595,8 +591,8 @@
 	case cue.NotEqualOp:
 		i := b.big(a[0])
 		b.setNot("allOff", []*oaSchema{
-			b.kv("minItems", i),
-			b.kv("maxItems", i),
+			b.kv("minimum", i),
+			b.kv("maximum", i),
 		})
 
 	case cue.CallOp:
diff --git a/encoding/openapi/testdata/nums.cue b/encoding/openapi/testdata/nums.cue
index a20b36b..d5b19c6 100644
--- a/encoding/openapi/testdata/nums.cue
+++ b/encoding/openapi/testdata/nums.cue
@@ -1,3 +1,5 @@
 import "math"
 
 mul: math.MultipleOf(5)
+
+neq: !=4
diff --git a/encoding/openapi/testdata/nums.json b/encoding/openapi/testdata/nums.json
index 819d5e8..65c5564 100644
--- a/encoding/openapi/testdata/nums.json
+++ b/encoding/openapi/testdata/nums.json
@@ -6,6 +6,22 @@
          "mul": {
             "type": "number",
             "multipleOf": 5
+         },
+         "neq": {
+            "not": {
+               "type": "number",
+               "allOff": [
+                  {
+                     "type": "number",
+                     "minimum": 4
+                  },
+                  {
+                     "type": "number",
+                     "maximum": 4
+                  }
+               ]
+            },
+            "type": "number"
          }
       }
    }