encoding/openapi: make OrderedMap type opaque
The OrderedMap needs to be a pointer, which may be
a bit unintuitive it being a slice. Change it to as struct.
Info is left as a non-pointer to indicate the non-optional
nature of it. The user of pointers is enforced by making
MarshalJSON only work for pointer types.
Change-Id: I8481dd8974825928815bfef3acd1eb5fc0274029
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/2460
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
diff --git a/encoding/openapi/testdata/oneof-funcs.json b/encoding/openapi/testdata/oneof-funcs.json
index 2ca742f..1510628 100644
--- a/encoding/openapi/testdata/oneof-funcs.json
+++ b/encoding/openapi/testdata/oneof-funcs.json
@@ -50,8 +50,8 @@
"count"
],
"properties": {
- "count": {
- "$ref": "#/components/schema/MYINT"
+ "include": {
+ "$ref": "#/components/schema/MYSTRING"
},
"exclude": {
"description": "Randomly picked description from a set of size one.",
@@ -60,8 +60,8 @@
"$ref": "#/components/schema/MYSTRING"
}
},
- "include": {
- "$ref": "#/components/schema/MYSTRING"
+ "count": {
+ "$ref": "#/components/schema/MYINT"
}
}
}
diff --git a/encoding/openapi/testdata/oneof.json b/encoding/openapi/testdata/oneof.json
index 83384fb..f37e664 100644
--- a/encoding/openapi/testdata/oneof.json
+++ b/encoding/openapi/testdata/oneof.json
@@ -42,8 +42,8 @@
"count"
],
"properties": {
- "count": {
- "$ref": "#/components/schema/MyInt"
+ "include": {
+ "$ref": "#/components/schema/MyString"
},
"exclude": {
"type": "array",
@@ -51,8 +51,8 @@
"$ref": "#/components/schema/MyString"
}
},
- "include": {
- "$ref": "#/components/schema/MyString"
+ "count": {
+ "$ref": "#/components/schema/MyInt"
}
}
}
diff --git a/encoding/openapi/testdata/openapi-norefs.json b/encoding/openapi/testdata/openapi-norefs.json
index d6f80b3..425130b 100644
--- a/encoding/openapi/testdata/openapi-norefs.json
+++ b/encoding/openapi/testdata/openapi-norefs.json
@@ -16,18 +16,6 @@
"bar"
],
"properties": {
- "bar": {
- "type": "array",
- "items": {
- "type": "string",
- "format": "string"
- }
- },
- "foo": {
- "type": "number",
- "exclusiveMinimum": 10,
- "exclusiveMaximum": 1000
- },
"port": {
"type": "object",
"required": [
@@ -35,16 +23,28 @@
"obj"
],
"properties": {
+ "port": {
+ "type": "integer"
+ },
"obj": {
"type": "array",
"items": {
"type": "integer"
}
- },
- "port": {
- "type": "integer"
}
}
+ },
+ "foo": {
+ "type": "number",
+ "exclusiveMinimum": 10,
+ "exclusiveMaximum": 1000
+ },
+ "bar": {
+ "type": "array",
+ "items": {
+ "type": "string",
+ "format": "string"
+ }
}
}
},
@@ -89,14 +89,14 @@
"obj"
],
"properties": {
+ "port": {
+ "type": "integer"
+ },
"obj": {
"type": "array",
"items": {
"type": "integer"
}
- },
- "port": {
- "type": "integer"
}
}
},
@@ -277,14 +277,14 @@
"obj"
],
"properties": {
+ "port": {
+ "type": "integer"
+ },
"obj": {
"type": "array",
"items": {
"type": "integer"
}
- },
- "port": {
- "type": "integer"
}
}
},
diff --git a/encoding/openapi/testdata/openapi.json b/encoding/openapi/testdata/openapi.json
index d4c6691..d64d270 100644
--- a/encoding/openapi/testdata/openapi.json
+++ b/encoding/openapi/testdata/openapi.json
@@ -13,12 +13,9 @@
"bar"
],
"properties": {
- "bar": {
- "type": "array",
- "items": {
- "type": "string",
- "format": "string"
- }
+ "port": {
+ "$ref": "#/components/schema/Port",
+ "type": "object"
},
"foo": {
"allOf": [
@@ -32,9 +29,12 @@
}
]
},
- "port": {
- "$ref": "#/components/schema/Port",
- "type": "object"
+ "bar": {
+ "type": "array",
+ "items": {
+ "type": "string",
+ "format": "string"
+ }
}
}
},
@@ -79,14 +79,14 @@
"obj"
],
"properties": {
+ "port": {
+ "type": "integer"
+ },
"obj": {
"type": "array",
"items": {
"type": "integer"
}
- },
- "port": {
- "type": "integer"
}
}
},
diff --git a/encoding/openapi/testdata/simple-filter.json b/encoding/openapi/testdata/simple-filter.json
index a971c73..8760bcd 100644
--- a/encoding/openapi/testdata/simple-filter.json
+++ b/encoding/openapi/testdata/simple-filter.json
@@ -15,20 +15,20 @@
"double"
],
"properties": {
- "double": {
- "type": "number",
- "format": "double"
- },
- "float": {
- "type": "number",
- "format": "float"
- },
"mediumNum": {
"type": "integer",
"format": "int32"
},
"smallNum": {
"type": "integer"
+ },
+ "float": {
+ "type": "number",
+ "format": "float"
+ },
+ "double": {
+ "type": "number",
+ "format": "double"
}
}
}
diff --git a/encoding/openapi/testdata/simple.json b/encoding/openapi/testdata/simple.json
index ce7675e..ee9aa52 100644
--- a/encoding/openapi/testdata/simple.json
+++ b/encoding/openapi/testdata/simple.json
@@ -15,14 +15,6 @@
"double"
],
"properties": {
- "double": {
- "type": "number",
- "format": "double"
- },
- "float": {
- "type": "number",
- "format": "float"
- },
"mediumNum": {
"type": "integer",
"format": "int32"
@@ -31,6 +23,14 @@
"type": "integer",
"minimum": -128,
"maximum": 127
+ },
+ "float": {
+ "type": "number",
+ "format": "float"
+ },
+ "double": {
+ "type": "number",
+ "format": "double"
}
}
}