Less "anyOf" when unnecessary

This commit is contained in:
Matt 2024-05-10 13:24:23 +01:00
parent 9faf6f4e56
commit 0e50045cf3
2 changed files with 2 additions and 2 deletions

View File

@ -3,7 +3,7 @@ import re
from typing import Any, Union, get_args, get_origin, get_type_hints
BASIC_TYPES = (int, float, str, bool, Any)
BASIC_TYPES = (int, float, str, bool, Any, type(None), ...)
def get_json_schema(func):

View File

@ -171,7 +171,7 @@ class JsonSchemaGeneratorTest(unittest.TestCase):
"properties": {
"x": {"type": "array", "items": {"type": ["integer", "number"]}, "description": "The input"},
"y": {
"anyOf": [{"type": "integer"}, {"type": "string"}],
"type": ["integer", "string"],
"nullable": True,
"description": "Also the input",
},