graphql-rust / juniper

GraphQL server library for Rust
Other
5.69k stars 422 forks source link

Stable order in generated schema's SDL (#1134) #1237

Closed tyranron closed 8 months ago

tyranron commented 8 months ago

Resolves #1134, #865

Synopsis

See #1134 for details:

Currently, the order persists between compilations as long as there are no changes to schema, but a change to one item commonly results in multiple unrelated items changing their position.

Solution

The solution is based on the https://github.com/graphql-rust/juniper/issues/1134#issuecomment-1704425425 approach, proposed and implemented by @michael-groble for the graphql-parser directly.

We ship it without waiting for a graphql-parser, and later can switch to the solution provided by the graphql-parser out-of-the-box.

Additionally

This PR removes the graphql-parser Cargo feature of juniper, because it effectively exposed the RootNode::as_parser_document() method only, hardly overlapping with the schema-language Cargo feature exposing RootNode::as_schema_language() method only.

Since they're very similar, now it's only the schema-language Cargo feature is left, exposing both RootNode::as_sdl() and RootNode::as_document() methods.

Checklist

tyranron commented 8 months ago

@LegNeato please look whether you have any comments on this.