pkg/math: added MultipleOf

Also:
- add support for Decimal type (internal)
- add correspondng support in openapi package

Change-Id: Idc4b829423bba63380a8edfc1109c345f4248355
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/2640
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
diff --git a/encoding/openapi/build.go b/encoding/openapi/build.go
index 8387c72..d2315fa 100644
--- a/encoding/openapi/build.go
+++ b/encoding/openapi/build.go
@@ -435,7 +435,7 @@
 
 // object supports the following
 // - maxProperties: maximum allowed fields in this struct.
-// - minProperties: minimum required fields in this struct.a
+// - minProperties: minimum required fields in this struct.
 // - patternProperties: [regexp]: schema
 //   TODO: we can support this once .kv(key, value) allow
 //      foo [=~"pattern"]: type
@@ -599,6 +599,18 @@
 			b.kv("maxItems", i),
 		})
 
+	case cue.CallOp:
+		name := fmt.Sprint(a[0])
+		switch name {
+		case "math.MultipleOf":
+			if len(a) != 2 {
+				b.failf(v, "builtin %v may only be used with single argument", name)
+			}
+			b.setFilter("Schema", "multipleOf", b.int(a[1]))
+		default:
+			b.failf(v, "builtin %v not supported in OpenAPI", name)
+		}
+
 	case cue.NoOp:
 		// TODO: extract format from specific type.