Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not default to adding None as accepted tuple for FloatRangeTupleDataclassField #3146

Merged
merged 1 commit into from
Feb 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions ludwig/schema/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -933,16 +933,18 @@ def _jsonschema_type_mapping(self):
items_schema["minimum"] = min
if max is not None:
items_schema["maximum"] = max
one_of = [
{
"type": "array",
"items": [{**items_schema}] * n,
"default": default,
"description": description,
},
]
if allow_none:
one_of.append({"type": "null", "title": "null_float_tuple_option", "description": "None"})
return {
"oneOf": [
{
"type": "array",
"items": [{**items_schema}] * n,
"default": default,
"description": description,
},
{"type": "null", "title": "null_float_tuple_option", "description": "None"},
],
"oneOf": one_of,
"title": self.name,
"default": default,
"description": "Valid options for FloatRangeTupleDataclassField.",
Expand Down