Repository: Dorthu/openapi3

Issue:
SpecError when the result is an array
```
openapi3.errors.SpecError: Expected paths./phone/batch_locations.post.responses.201.content.application/json.examples.response.value to be one of [Reference,<class 'dict'>,<class 'str'>], got <class 'list'>
```

The attached file is a reduced version of the spec that exhibits the problem, available from https://marketplace.zoom.us/docs/page-data/api-reference/phone/methods/page-data.json (you need to access `R.result.pageContext.OAS.spec`, then add an `email` field to the `contact` object, duh) where I found the problem.

[phone.json.txt](https://github.com/Dorthu/openapi3/files/8187138/phone.json.txt)


Discussion:

Patch:
diff --git a/openapi3/example.py b/openapi3/example.py
index ea9a959..b2185d0 100644
--- a/openapi3/example.py
+++ b/openapi3/example.py
@@ -17,5 +17,5 @@ class Example(ObjectBase):
         """
         self.summary = self._get("summary", str)
         self.description = self._get("description", str)
-        self.value = self._get("value", ["Reference", dict, str])  # 'any' type
+        self.value = self._get("value", "*")
         self.externalValue = self._get("externalValue", str)
diff --git a/openapi3/paths.py b/openapi3/paths.py
index 0b31cc1..6891ad5 100644
--- a/openapi3/paths.py
+++ b/openapi3/paths.py
@@ -467,7 +467,7 @@ class MediaType(ObjectBase):
         Implementation of :any:`ObjectBase._parse_data`
         """
         self.schema = self._get("schema", ["Schema", "Reference"])
-        self.example = self._get("example", str)  # 'any' type
+        self.example = self._get("example", "*")
         self.examples = self._get("examples", ["Example", "Reference"], is_map=True)
         self.encoding = self._get("encoding", dict)  # Map['Encoding']
 


Test patch:
diff --git a/tests/conftest.py b/tests/conftest.py
index b4e83cf..0e92712 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -186,3 +186,11 @@ def rfc_6901():
     Provides a spec that includes RFC 6901 escape codes in ref paths
     """
     yield _get_parsed_yaml("rfc_6901.yaml")
+
+
+@pytest.fixture
+def with_array_example():
+    """
+    Provides a spec that includes arrays as the value of examples
+    """
+    yield _get_parsed_yaml("example_array.yaml")
diff --git a/tests/fixtures/example_array.yaml b/tests/fixtures/example_array.yaml
new file mode 100644
index 0000000..e47cf16
--- /dev/null
+++ b/tests/fixtures/example_array.yaml
@@ -0,0 +1,41 @@
+# this is a valid spec that contains a schema with an array as the value of an
+# exmaple object
+openapi: "3.1.0"
+info:
+  version: 1.0.0
+  title: Examples Array
+paths:
+  /example:
+    get:
+      operationId: exampleArrayGet
+      responses:
+        '200':
+          description: example
+          content:
+            application/json:
+              example:
+                - name: something
+              schema:
+                properties:
+                  name:
+                    type: string
+                    description: example
+                    example: something
+  /examples:
+    get:
+      operationId: examplesArrayGet
+      responses:
+        '200':
+          description: example
+          content:
+            application/json:
+              examples:
+                one:
+                  value:
+                    - name: something
+              schema:
+                properties:
+                  name:
+                    type: string
+                    description: example
+                    example: something
diff --git a/tests/parsing_test.py b/tests/parsing_test.py
index 74bcda3..b69036a 100644
--- a/tests/parsing_test.py
+++ b/tests/parsing_test.py
@@ -132,3 +132,11 @@ def test_securityparameters(with_securityparameters):
     spec = OpenAPI(with_securityparameters, validate=True)
     errors = spec.errors()
     assert len(errors) == 0
+
+
+def test_example_type_array(with_array_example):
+    """
+    Tests that examples, definied as "any" type, accept arrays
+    """
+    spec = OpenAPI(with_array_example, validate=True)
+    assert len(spec.errors()) == 0, spec.errors()