Comments (7)
What does sortable mean?
from parser.
Well, like the root of a SDL is equally valid no matter which order types are defined in. Same is probably true for a list of field definitions. However, changing the order of a selection set would change the order that the query is processed. So some list types can be sorted without affecting anything, and others cannot.
I'm specifically thinking of type definitions, where it is important for me to be able to produce a sorted list of type definitions, with the field definitions within each type definition sorted, and the argument definitions within each field definition sorted.
from parser.
As it is now, I think the old SchemaPrinter could sort type names but did not sort field or argument names, or something. It would cause tests to intermittently fail because the types were dynamically generated from .NET classes, and .NET reflection would not consistently return methods/arguments in the same order even when the source did not change. (Mostly due to the Visual Studio partial-building optimizations, I think, because if I rebuild all or build from CI, then it would always compile the same.)
from parser.
However, changing the order of a selection set would change the order that the query is processed.
The same for applied directives - the order matters. We have SchemaPrinterOptions.Comparer
property to handle sorting. I'm rewritting all this stuff now. I can add some lost comparers (for example, for implemented interfaces) that I found when wrote code to convert Schema
to GraphQLDocument
. Note that ISchemaComparer
works both for printing and introspection. Also there is AlphabeticalSchemaComparer
that should already handle what you called Sorted.
from parser.
I'm specifically thinking of type definitions, where it is important for me to be able to produce a sorted list
I understand. I widely use SchemaPrinter
at work in API approval tests to verify unintentional changes in our GraphQL schemas.
from parser.
Nice. π So close this now?
from parser.
OK to close.
from parser.
Related Issues (20)
- Ensure October spec compliance before v8 release and publish release
- Optimize comments and block strings
- Don't track branch coverage for Debug.Assert HOT 4
- Publish v8.1.0 release HOT 1
- Fix readme on Nuget
- SDLPrinter.Print in addition to SDLPrinter.PrintAsync HOT 8
- Strange formatting of input types with descriptions HOT 16
- More Parse methods HOT 5
- Revise AST constructors
- Add tests to increase code coverage up to 100%
- 9.0.1 formatting - lost indentation of arguments (fine in 8.x) HOT 4
- All literals should have proper indentation in case of preceding comments
- Inconsistent formatting of arguments HOT 16
- Suggested feature: default AST visitor context
- Fix broken indentation
- There's an extra space here also, between `...` and `@skip`.
- Handle whitespaces somehow HOT 3
- Pretty print graphql query? HOT 9
- Printing SDL drops βmutationβ
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 parser.