-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add universal JSONLogic type, which is essentially a union of all ava…
…ilable operations (#10)
- Loading branch information
Showing
2 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from pydantic import BaseModel | ||
|
||
from pydantic_jsonlogic import All, JSONLogic | ||
|
||
|
||
class SomeModel(BaseModel): | ||
json_logic: JSONLogic | ||
|
||
|
||
def test_model_integration() -> None: | ||
model = SomeModel.model_validate_json( | ||
'{"json_logic": {"all":[{"var":"integers"}, {">=":[{"var":""}, 1]}]}}' | ||
) | ||
assert isinstance(model.json_logic, All) |