From 3e4f112d54788f9baf8f713588cf1fb080346380 Mon Sep 17 00:00:00 2001 From: Richard Kojedzinszky Date: Wed, 9 Oct 2024 09:19:38 +0200 Subject: [PATCH] fix(openapi): convert more sub-schemas --- src/middlewared/middlewared/restful.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/middlewared/middlewared/restful.py b/src/middlewared/middlewared/restful.py index d6a8db87e7091..40079ba078956 100644 --- a/src/middlewared/middlewared/restful.py +++ b/src/middlewared/middlewared/restful.py @@ -368,11 +368,13 @@ def _convert_schema(self, schema): if item.get('type') == 'null': items.remove(item) if len(items) > 1: - schema['items'] = {'oneOf': items} + schema['items'] = {'oneOf': list(map(self._convert_schema, items))} elif len(items) > 0: - schema['items'] = items[0] + schema['items'] = self._convert_schema(items[0]) else: schema['items'] = {} + if anyOf := schema.get('anyOf', None): + schema['anyOf'] = list(map(self._convert_schema, anyOf)) return schema def _returns_to_request(self, methodname, method_returns):