Skip to content

Commit

Permalink
[#4832] Fixed json schema matcher in Objects API
Browse files Browse the repository at this point in the history
This change has been made because we are not able to know if the type is
the correct one when no format is defined in the variable. This is left
to the user and we assume that the mapping is valid.

Backport-of: #4938
  • Loading branch information
vaszig committed Dec 18, 2024
1 parent fa35b36 commit 4ad3c9b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/openforms/contrib/objects_api/json_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def json_schema_matches(
if "string" in target_types and (target_format := target_schema.get("format")):
variable_format = variable_schema.get("format")
if variable_format is None:
return False
return True
return variable_format == target_format

return True
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ def test_json_schema_matches(self):
variable_schema = {"type": "string"}
target_schema = {"type": "string", "format": "email"}

self.assertFalse(
self.assertTrue(
json_schema_matches(
variable_schema=variable_schema, target_schema=target_schema
)
Expand Down

0 comments on commit 4ad3c9b

Please sign in to comment.