encoding/openapi: add paths:{}

Openapi specs are missing the paths attributes, which is a required attribute. This adds an empty paths attribute to the generated openapi spec.

Change-Id: I18d98da0da0a042acb3f382ad38901f71b6f05d8

Fixes #134

Change-Id: I18d98da0da0a042acb3f382ad38901f71b6f05d8
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/3420
Reviewed-by: Eric Adlam <eadlam@gmail.com>
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
diff --git a/encoding/openapi/openapi.go b/encoding/openapi/openapi.go
index 3da88ca..a8692bf 100644
--- a/encoding/openapi/openapi.go
+++ b/encoding/openapi/openapi.go
@@ -86,6 +86,7 @@
 	top := &OrderedMap{}
 	top.Set("openapi", "3.0.0")
 	top.Set("info", &g.Info)
+	top.Set("paths", &OrderedMap{})
 	top.Set("components", schemas)
 
 	return top, nil
diff --git a/encoding/openapi/testdata/array.json b/encoding/openapi/testdata/array.json
index 5a9136a..f4d2a32 100644
--- a/encoding/openapi/testdata/array.json
+++ b/encoding/openapi/testdata/array.json
@@ -1,6 +1,7 @@
 {
    "openapi": "3.0.0",
    "info": {},
+   "paths": {},
    "components": {
       "schemas": {
          "Arrays": {
diff --git a/encoding/openapi/testdata/builtins.json b/encoding/openapi/testdata/builtins.json
index 1442f6c..b5fec88 100644
--- a/encoding/openapi/testdata/builtins.json
+++ b/encoding/openapi/testdata/builtins.json
@@ -1,6 +1,7 @@
 {
    "openapi": "3.0.0",
    "info": {},
+   "paths": {},
    "components": {
       "schemas": {
          "MyStruct": {
diff --git a/encoding/openapi/testdata/nums.json b/encoding/openapi/testdata/nums.json
index 69874fe..e26da85 100644
--- a/encoding/openapi/testdata/nums.json
+++ b/encoding/openapi/testdata/nums.json
@@ -1,6 +1,7 @@
 {
    "openapi": "3.0.0",
    "info": {},
+   "paths": {},
    "components": {
       "schemas": {
          "mul": {
diff --git a/encoding/openapi/testdata/oneof-funcs.json b/encoding/openapi/testdata/oneof-funcs.json
index 157b53c..104adcb 100644
--- a/encoding/openapi/testdata/oneof-funcs.json
+++ b/encoding/openapi/testdata/oneof-funcs.json
@@ -4,6 +4,7 @@
       "title": "test",
       "version": "v1"
    },
+   "paths": {},
    "components": {
       "schemas": {
          "MYSTRING": {
diff --git a/encoding/openapi/testdata/oneof-resolve.json b/encoding/openapi/testdata/oneof-resolve.json
index 629e0dd..629db2f 100644
--- a/encoding/openapi/testdata/oneof-resolve.json
+++ b/encoding/openapi/testdata/oneof-resolve.json
@@ -4,6 +4,7 @@
       "title": "test",
       "version": "v1"
    },
+   "paths": {},
    "components": {
       "schemas": {
          "MyString": {
diff --git a/encoding/openapi/testdata/oneof.json b/encoding/openapi/testdata/oneof.json
index b2c0c97..cb84e49 100644
--- a/encoding/openapi/testdata/oneof.json
+++ b/encoding/openapi/testdata/oneof.json
@@ -1,6 +1,7 @@
 {
    "openapi": "3.0.0",
    "info": {},
+   "paths": {},
    "components": {
       "schemas": {
          "MyString": {
diff --git a/encoding/openapi/testdata/openapi-norefs.json b/encoding/openapi/testdata/openapi-norefs.json
index 0c7e922..dc246b1 100644
--- a/encoding/openapi/testdata/openapi-norefs.json
+++ b/encoding/openapi/testdata/openapi-norefs.json
@@ -4,6 +4,7 @@
       "title": "test",
       "version": "v1"
    },
+   "paths": {},
    "components": {
       "schemas": {
          "MyMessage": {
diff --git a/encoding/openapi/testdata/openapi.json b/encoding/openapi/testdata/openapi.json
index a8b888a..07dcba3 100644
--- a/encoding/openapi/testdata/openapi.json
+++ b/encoding/openapi/testdata/openapi.json
@@ -1,6 +1,7 @@
 {
    "openapi": "3.0.0",
    "info": {},
+   "paths": {},
    "components": {
       "schemas": {
          "MyMessage": {
diff --git a/encoding/openapi/testdata/refs.json b/encoding/openapi/testdata/refs.json
index c6d5654..e73e4ee 100644
--- a/encoding/openapi/testdata/refs.json
+++ b/encoding/openapi/testdata/refs.json
@@ -4,6 +4,7 @@
       "title": "test",
       "version": "v1"
    },
+   "paths": {},
    "components": {
       "schemas": {
          "Keep": {
diff --git a/encoding/openapi/testdata/simple-filter.json b/encoding/openapi/testdata/simple-filter.json
index 76b3d29..e12b2f7 100644
--- a/encoding/openapi/testdata/simple-filter.json
+++ b/encoding/openapi/testdata/simple-filter.json
@@ -4,6 +4,7 @@
       "title": "test",
       "version": "v1"
    },
+   "paths": {},
    "components": {
       "schemas": {
          "MyStruct": {
diff --git a/encoding/openapi/testdata/simple.json b/encoding/openapi/testdata/simple.json
index c2e88d3..3d5b306 100644
--- a/encoding/openapi/testdata/simple.json
+++ b/encoding/openapi/testdata/simple.json
@@ -4,6 +4,7 @@
       "title": "test",
       "version": "v1"
    },
+   "paths": {},
    "components": {
       "schemas": {
          "MyStruct": {
diff --git a/encoding/openapi/testdata/strings.json b/encoding/openapi/testdata/strings.json
index 4b8123b..8a2c574 100644
--- a/encoding/openapi/testdata/strings.json
+++ b/encoding/openapi/testdata/strings.json
@@ -1,6 +1,7 @@
 {
    "openapi": "3.0.0",
    "info": {},
+   "paths": {},
    "components": {
       "schemas": {
          "MyType": {
diff --git a/encoding/openapi/testdata/struct.json b/encoding/openapi/testdata/struct.json
index a4c2b13..d2b5c6b 100644
--- a/encoding/openapi/testdata/struct.json
+++ b/encoding/openapi/testdata/struct.json
@@ -1,6 +1,7 @@
 {
    "openapi": "3.0.0",
    "info": {},
+   "paths": {},
    "components": {
       "schemas": {
          "MyMap": {
diff --git a/encoding/openapi/testdata/structural.json b/encoding/openapi/testdata/structural.json
index b1beee2..dab5eb7 100644
--- a/encoding/openapi/testdata/structural.json
+++ b/encoding/openapi/testdata/structural.json
@@ -4,6 +4,7 @@
       "title": "test",
       "version": "v1"
    },
+   "paths": {},
    "components": {
       "schemas": {
          "Attributes": {