encoding/openapi: add Info and DescriptorFunc features

Two settings added to Generator:

- Info adds the OpenAPI info section.
- DescriptorFunc allows for custom descriptions, given
  a value.

If the All API is used, an empty info section will be added
if the user hasn't given any. This is to reflect the fact
that info.version and info.title are required.

Issue #56

Change-Id: Ief29b40bf6be9c8026052588f6de9fb06d41095f
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/2442
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
diff --git a/encoding/openapi/testdata/array.json b/encoding/openapi/testdata/array.json
index 4b29400..88597a0 100644
--- a/encoding/openapi/testdata/array.json
+++ b/encoding/openapi/testdata/array.json
@@ -1,5 +1,6 @@
 {
    "openapi": "3.0.0",
+   "info": {},
    "components": {
       "schema": {
          "Arrays": {
diff --git a/encoding/openapi/testdata/oneof-funcs.json b/encoding/openapi/testdata/oneof-funcs.json
new file mode 100644
index 0000000..2ca742f
--- /dev/null
+++ b/encoding/openapi/testdata/oneof-funcs.json
@@ -0,0 +1,70 @@
+{
+   "openapi": "3.0.0",
+   "info": {
+      "title": "test",
+      "version": "v1"
+   },
+   "components": {
+      "schema": {
+         "MYSTRING": {
+            "description": "Randomly picked description from a set of size one.",
+            "oneOf": [
+               {
+                  "type": "object",
+                  "required": [
+                     "exact"
+                  ],
+                  "properties": {
+                     "exact": {
+                        "description": "Randomly picked description from a set of size one.",
+                        "type": "string",
+                        "format": "string"
+                     }
+                  }
+               },
+               {
+                  "type": "object",
+                  "required": [
+                     "regex"
+                  ],
+                  "properties": {
+                     "regex": {
+                        "description": "Randomly picked description from a set of size one.",
+                        "type": "string",
+                        "format": "string"
+                     }
+                  }
+               }
+            ]
+         },
+         "MYINT": {
+            "description": "Randomly picked description from a set of size one.",
+            "type": "integer"
+         },
+         "FOO": {
+            "description": "Randomly picked description from a set of size one.",
+            "type": "object",
+            "required": [
+               "include",
+               "exclude",
+               "count"
+            ],
+            "properties": {
+               "count": {
+                  "$ref": "#/components/schema/MYINT"
+               },
+               "exclude": {
+                  "description": "Randomly picked description from a set of size one.",
+                  "type": "array",
+                  "items": {
+                     "$ref": "#/components/schema/MYSTRING"
+                  }
+               },
+               "include": {
+                  "$ref": "#/components/schema/MYSTRING"
+               }
+            }
+         }
+      }
+   }
+}
\ No newline at end of file
diff --git a/encoding/openapi/testdata/oneof.json b/encoding/openapi/testdata/oneof.json
index ce39ad4..83384fb 100644
--- a/encoding/openapi/testdata/oneof.json
+++ b/encoding/openapi/testdata/oneof.json
@@ -1,5 +1,6 @@
 {
    "openapi": "3.0.0",
+   "info": {},
    "components": {
       "schema": {
          "MyString": {
diff --git a/encoding/openapi/testdata/openapi-norefs.json b/encoding/openapi/testdata/openapi-norefs.json
index 00803cd..d6f80b3 100644
--- a/encoding/openapi/testdata/openapi-norefs.json
+++ b/encoding/openapi/testdata/openapi-norefs.json
@@ -1,5 +1,9 @@
 {
    "openapi": "3.0.0",
+   "info": {
+      "title": "test",
+      "version": "v1"
+   },
    "components": {
       "schema": {
          "MyMessage": {
diff --git a/encoding/openapi/testdata/openapi.json b/encoding/openapi/testdata/openapi.json
index c0ef7db..d4c6691 100644
--- a/encoding/openapi/testdata/openapi.json
+++ b/encoding/openapi/testdata/openapi.json
@@ -1,5 +1,6 @@
 {
    "openapi": "3.0.0",
+   "info": {},
    "components": {
       "schema": {
          "MyMessage": {
diff --git a/encoding/openapi/testdata/simple.json b/encoding/openapi/testdata/simple.json
index 8110d69..ce7675e 100644
--- a/encoding/openapi/testdata/simple.json
+++ b/encoding/openapi/testdata/simple.json
@@ -1,5 +1,9 @@
 {
    "openapi": "3.0.0",
+   "info": {
+      "title": "test",
+      "version": "v1"
+   },
    "components": {
       "schema": {
          "MyStruct": {