Comments (8)
Seems like mustache is parsing these values correctly the root cause if I'm not mistaken is when render_value is getting invoked and reaching this line :
tailcall/src/core/serde_value_ext.rs
Line 20 in 9cdf3ef
from tailcall.
This bug is trickier than I thought. The line I shared above doesn't seem to be the main root cause, if I find s solid fix I'll push a PR.
from tailcall.
the mustache parser probably not the issue itself (although, it does strip "
symbols from input on parsing) but mostly the render. Since Mustache::render is mostly made for using in strings like urls the output is generated without quotes and when we try to convert it back to serde::Value we get the converted value that could be a string in the first place.
I think it could be solved with the change like was made here https://github.com/tailcallhq/tailcall/pull/1556/files#diff-855a66b57f6600cfd1af0da76b2be55e275d89f3d3fb57cfa03255b1b0aef453 i.e. return Value
from Mustache::render
instead of string. But this pr wasn't merged due to performance implications.
from tailcall.
the mustache parser probably not the issue itself (although, it does strip
"
symbols from input on parsing) but mostly the render. Since Mustache::render is mostly made for using in strings like urls the output is generated without quotes and when we try to convert it back to serde::Value we get the converted value that could be a string in the first place.I think it could be solved with the change like was made here https://github.com/tailcallhq/tailcall/pull/1556/files#diff-855a66b57f6600cfd1af0da76b2be55e275d89f3d3fb57cfa03255b1b0aef453 i.e. return
Value
fromMustache::render
instead of string. But this pr wasn't merged due to performance implications.
That's what I concluded too and why I said it's tricky for me because I don't know the codebase well.
I was thinking about changing the PathString trait and making the path_string return a tuple something like (type, Cow) where the type is the type that got converted and we can match against it inside that block if it was a string simply return GraphQLValue::String otherwise keep the logic as is, but I don't know if that's a solid idea because it require all the implementers of this trait to do the same thing. what are you thoughts ?
Line 17 in 5f54bca
from tailcall.
seems like the issue could be resolved by this issue #1535 and more precisely this part "Optimize serde_value_ext::render_value. It renders itself as a string and then deserializes it as json."
@tusharmath do you have any plans on #1535?
from tailcall.
Just wanted to extend on my idea to make sure it's clear enough, I re-read the the implementers of PathString and if I would to return a tuple from the path_string the type that's going to be returned is simply an enum that looks exactly the same as serde_json::Value and async_graphql::Value
Something like :
enum TailCallValue {
String,
List,
Object,
Bool
}
it's a cheap one but it could solve this problem(with potentially not a lot of changes)
from tailcall.
Action required: Issue inactive for 30 days.
Status update or closure in 7 days.
from tailcall.
Issue closed after 7 days of inactivity.
from tailcall.
Related Issues (20)
- refactor: drop `to_sdl` method on `config_module` HOT 6
- chore: Expose `JIT` executor via the `request_handler` HOT 11
- transformer to flatten out types with single field HOT 19
- bug: improve path variable detection logic in config generator. HOT 5
- feat: add allowedHeaders setting in upstream when the api requires some headers for config generator.
- chore: Parameterize `json_placeholder.rs` HOT 15
- feat: disable the default presets which are applied on configuration during config generation. HOT 2
- create a HTTP client per thread HOT 15
- wrong type for the body parameter of the grpc directive HOT 8
- use `RWLock` in `dedupe` HOT 6
- Improve performance of `cargo build` whenever `src` changes by one order of magnitude. HOT 10
- refactor: `JsonLike` return an `Option` instead of `Result` from the methods. HOT 8
- chore: make `validate` function generic in `Scalar` trait HOT 4
- chore: parameterize Synth HOT 6
- Handle resolving a null field with @http HOT 10
- Add support for `skipNull: true` in HTTP directive query parameters HOT 9
- refactor: Make `JsonPlaceholder.rs` parametric HOT 8
- Support `@modify` on inputs HOT 3
- bug: Config Generation Better Names HOT 8
- Batching with nested HTTP responses HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tailcall.