-
Notifications
You must be signed in to change notification settings - Fork 3
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 array and object encoding #152
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there any way to encode query arguments? the @object
and @array
values still work as-is, and they are the only way to encode query arguments as an object or array.
@@ -24,58 +24,52 @@ class FaunaEncoder: | |||
+-------------------------------+---------------+ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i can't comment on it, but _RESERVED_TAGS
, above this, is no longer used.
Is there a reason to support this? The driver only supports the query interpolation protocol, not a simple query with arguments. Given that, in which scenarios would you use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the driver doesn't support the arguments
field, then yes you're fine to just use the new object
/array
format everywhere. The JS driver supports that arguments
field, so I was just wondering if we supported that on other drivers too.
Ticket(s): BT-4174
Problem
We need to support encoding that allows query composers to pass objects and arrays that include other FQL queries as values.
Solution
Modify encoding to encode to the { "array": .. } and { "object": .. } protocol, and always encode primitives and Fauna special types with { "value": ... }
This implementation treats the "ValueFragment" as more of a "VariableFragment" and leaves how it should be encoded to the encoder.
The outgoing wire protocol in this driver now differs from the incoming protocol. For example, we do not expect to receive { "object: .. } and { "array": .. } from Fauna, but rather the tagged type format Fauna in response.
All queries emitted from this driver will adhere to this protocol.
Out of Scope
Any refactoring to separate tagged typing from wire encoding because it doesn't support timelines for support of this feature.
Testing
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.