This is an automated email from the ASF dual-hosted git repository.
apratim pushed a commit to branch main
in repository
https://gitbox.apache.org/repos/asf/incubator-resilientdb-graphql.git
The following commit(s) were added to refs/heads/main by this push:
new 05ff317 Update app.py
05ff317 is described below
commit 05ff317c2f4b7fbd210a361fae35f272d2621776
Author: Apratim Shukla <[email protected]>
AuthorDate: Tue Mar 11 03:38:21 2025 -0700
Update app.py
---
app.py | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/app.py b/app.py
index dcea825..c5e6900 100644
--- a/app.py
+++ b/app.py
@@ -29,8 +29,9 @@ db = Resdb(db_root_url)
import strawberry
import typing
import ast
-from typing import Optional, List
+import json
+from typing import Optional, List, Any
from flask import Flask
from flask_cors import CORS
@@ -39,6 +40,16 @@ CORS(app) # This will enable CORS for all routes
from strawberry.flask.views import GraphQLView
[email protected](description="Custom JSON scalar")
+class JSONScalar:
+ @staticmethod
+ def serialize(value: Any) -> Any:
+ return value # Directly return the JSON object
+
+ @staticmethod
+ def parse_value(value: Any) -> Any:
+ return value # Accept JSON as is
+
@strawberry.type
class RetrieveTransaction:
id: str
@@ -49,7 +60,7 @@ class RetrieveTransaction:
publicKey: str
operation: str
metadata: typing.Optional["str"]
- asset: strawberry.JSON
+ asset: JSONScalar
signerPublicKey: str
@strawberry.type
@@ -63,7 +74,7 @@ class PrepareAsset:
signerPublicKey: str
signerPrivateKey: str
recipientPublicKey: str
- asset: strawberry.JSON
+ asset: JSONScalar
@strawberry.type
class Query: