diff --git a/src/middlewared/middlewared/plugins/device.py b/src/middlewared/middlewared/plugins/device.py index a2805b646e6e..46469c4faabd 100644 --- a/src/middlewared/middlewared/plugins/device.py +++ b/src/middlewared/middlewared/plugins/device.py @@ -33,7 +33,7 @@ class Config: Str('pci_slot', required=True), Str('domain', required=True), Str('bus', required=True), - Str('slot', True), + Str('slot', required=True), ), Str('description', required=True), List('devices', items=[Dict( diff --git a/src/middlewared/middlewared/restful.py b/src/middlewared/middlewared/restful.py index d6a8db87e709..40079ba07895 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): diff --git a/src/middlewared/middlewared/schema/adaptable_schemas.py b/src/middlewared/middlewared/schema/adaptable_schemas.py index 7ff3fb8ac593..e094f9cafab0 100644 --- a/src/middlewared/middlewared/schema/adaptable_schemas.py +++ b/src/middlewared/middlewared/schema/adaptable_schemas.py @@ -15,8 +15,8 @@ def to_json_schema(self, parent=None): {'type': 'string'}, {'type': 'integer'}, {'type': 'boolean'}, - {'type': 'object'}, - {'type': 'array'}, + {'type': 'object', 'properties': {}}, + {'type': 'array', 'items': []}, ], 'nullable': self.null, **self._to_json_schema_common(parent), diff --git a/src/middlewared/middlewared/schema/integer_schema.py b/src/middlewared/middlewared/schema/integer_schema.py index 71a21759e625..3f40042641e5 100644 --- a/src/middlewared/middlewared/schema/integer_schema.py +++ b/src/middlewared/middlewared/schema/integer_schema.py @@ -56,6 +56,6 @@ def clean(self, value): def to_json_schema(self, parent=None): return { - 'type': ['float', 'null'] if self.null else 'float', + 'type': ['number', 'null'] if self.null else 'number', **self._to_json_schema_common(parent), }