Less "anyOf" when unnecessary
This commit is contained in:
parent
9faf6f4e56
commit
0e50045cf3
|
@ -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):
|
||||
|
|
|
@ -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",
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue