Open stojan-jovic opened 4 years ago
Ok, I figured out that this is not specifically related to oneOf
.
Issue is with syntax to support any type in array:
type: array
items: {}
The same issue is with following syntax (i.e. allow any type for value
parameter):
value: {}
All above formats should be allowed according to the official page for working with Data Types (section for the working with arrays and objects, part for any types, at the very end of the page).
Solution for my original issue would be something like this:
value:
oneOf:
- type: string
- type: number
- type: boolean
- type: array
items:
oneOf:
- type: string
- type: number
I also have get your error for no obvious reason for me.
But on a lot of route I get:
File "falcon\app.py", line 371, in falcon.app.App.__call__
File "C:\Users\Star\AppData\Local\Programs\Python\Python39\lib\site-packages\openapi_core\contrib\falcon\middlewares.py", line 38, in process_response
resp_result = super(FalconOpenAPIMiddleware, self).process_response(
File "C:\Users\Star\AppData\Local\Programs\Python\Python39\lib\site-packages\openapi_core\validation\processors.py", line 14, in process_response
return self.response_validator.validate(request, response)
File "C:\Users\Star\AppData\Local\Programs\Python\Python39\lib\site-packages\openapi_core\validation\response\validators.py", line 22, in validate
_, operation, _, _, _ = self._find_path(request)
File "C:\Users\Star\AppData\Local\Programs\Python\Python39\lib\site-packages\openapi_core\validation\validators.py", line 24, in _find_path
return finder.find(request)
File "C:\Users\Star\AppData\Local\Programs\Python\Python39\lib\site-packages\openapi_core\templating\paths\finders.py", line 25, in find
if not paths_iter_peek:
File "C:\Users\Star\AppData\Local\Programs\Python\Python39\lib\site-packages\more_itertools\more.py", line 302, in __bool__
self.peek()
File "C:\Users\Star\AppData\Local\Programs\Python\Python39\lib\site-packages\more_itertools\more.py", line 316, in peek
self._cache.append(next(self._it))
File "C:\Users\Star\AppData\Local\Programs\Python\Python39\lib\site-packages\openapi_core\templating\paths\finders.py", line 45, in _get_paths_iter
paths = self.spec / 'paths'
TypeError: unsupported operand type(s) for /: '_io.TextIOWrapper' and 'str'
Hope this can help.
Swagger spec:
It failed to validate
array
type forvalue
property (other types are validated fine, whenarray
is removed).Using lib in combination with Falcon, error is:
Maybe I'm doing something wrong (?!), but not found in OpenAPI documentation any limitation for
array
in usage withoneOf
, so I assume that above spec is valid and issue is definitely in the lib validation.