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

Add support for operators inside arrays #20

Closed
Viicos opened this issue May 28, 2024 · 0 comments · Fixed by #25
Closed

Add support for operators inside arrays #20

Viicos opened this issue May 28, 2024 · 0 comments · Fixed by #25

Comments

@Viicos
Copy link
Owner

Viicos commented May 28, 2024

As shown in the failing test, ["2000-01-01", {"var": "/my_date"}] is treated as is, as a literal.

@pytest.mark.xfail(reason="Arrays are currently considered as JSON Logic primitives.")
def test_map_op_in_values():
op = as_op({"map": [["2000-01-01", {"var": "/my_date"}], {">": [{"var": ""}, "1970-01-01"]}]})
rt, _ = typecheck(
op,
data_schema={"type": "object", "properties": {"my_date": {"type": "string", "format": "date"}}},
settings={"literal_casts": {date.fromisoformat: DateType}},
)
assert rt == ArrayType(BooleanType())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant