graphql-rust / graphql-parser

A graphql query language and schema definition language parser and formatter for rust
Apache License 2.0
355 stars 77 forks source link

Parameter ordering after formatting #70

Open rpgreen-vendia opened 1 year ago

rpgreen-vendia commented 1 year ago

Hello, What is the expected ordering of parameters after parsing and formatting? The result I am seeing is somewhat unexpected - nested object keys are sorted alphanumerically but top-level parameters are not. Is this expected and can it be relied on to be deterministic? Thanks

let s = parse_query::<String>(r#"mutation m {doFoo(c: 3, b: 2, d: 3, a: {z: 1, y: 2, x: 3 }, f: [{c: 3, b: 2, a:1}] ){error}}"#).unwrap().to_string();
println!("{}", s);

Outputs:

mutation m {
  doFoo(c: 3, b: 2, d: 3, a: {x: 3, y: 2, z: 1}, f: [{a: 1, b: 2, c: 3}]) {
    error
  }
}