apollographql / apollo-rs

Spec compliant GraphQL Tools in Rust.
Apache License 2.0
572 stars 45 forks source link

create serde_json Value from apollo-parser's AST #193

Open lrlna opened 2 years ago

lrlna commented 2 years ago

Description

It would be useful to have a serde_json Value implementation for some parts of the AST created by apollo-parser. Perhaps even for the whole AST? It seems like apollo-router is looking to have VALUE nodes as serde_json Value, but are there any other use cases?

I have a feeling this will be even more important once we start implementing GraphQL response part of the spec, so we might have a better idea of the requirements at that point in time.

networkimprov commented 1 year ago

Reposted from #500: I'm building a GraphQL client app in Rust, which enables user-defined queries against any service. I'm using Tauri for the UI (HTML/CSS/JS rendered by a webview), hence I need to manifest an AST in Javascript. A JS parser would work, but I'd rather use the apollo-rs parser!

Note, I need to both deserialize from JSON to AST as well as serialize.

Which AST types might need manual implementations of the Serde traits?