File tree 2 files changed +2
-13
lines changed
2 files changed +2
-13
lines changed Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ def _ensure_strict_json_schema(
54
54
elif (
55
55
typ == "object"
56
56
and "additionalProperties" in json_schema
57
- and json_schema ["additionalProperties" ]
57
+ and json_schema ["additionalProperties" ] is True
58
58
):
59
59
raise UserError (
60
60
"additionalProperties should not be set for object types. This could be because "
Original file line number Diff line number Diff line change 1
- from collections .abc import Mapping
2
1
from enum import Enum
3
2
from typing import Any , Literal
4
3
@@ -422,20 +421,10 @@ def test_var_keyword_dict_annotation():
422
421
def func (** kwargs : dict [str , int ]):
423
422
return kwargs
424
423
425
- fs = function_schema (func , use_docstring_info = False , strict_json_schema = False )
424
+ fs = function_schema (func , use_docstring_info = False )
426
425
427
426
properties = fs .params_json_schema .get ("properties" , {})
428
427
# The name of the field is "kwargs", and it's a JSON object i.e. a dict.
429
428
assert properties .get ("kwargs" ).get ("type" ) == "object"
430
429
# The values in the dict are integers.
431
430
assert properties .get ("kwargs" ).get ("additionalProperties" ).get ("type" ) == "integer"
432
-
433
-
434
- def test_schema_with_mapping_raises_strict_mode_error ():
435
- """A mapping type is not allowed in strict mode. Same for dicts. Ensure we raise a UserError."""
436
-
437
- def func_with_mapping (test_one : Mapping [str , int ]) -> str :
438
- return "foo"
439
-
440
- with pytest .raises (UserError ):
441
- function_schema (func_with_mapping )
You can’t perform that action at this time.
0 commit comments