Giter Club home page Giter Club logo

Comments (7)

sungam3r avatar sungam3r commented on July 30, 2024

What does sortable mean?

from parser.

Shane32 avatar Shane32 commented on July 30, 2024

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.

Shane32 avatar Shane32 commented on July 30, 2024

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.

sungam3r avatar sungam3r commented on July 30, 2024

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.

sungam3r avatar sungam3r commented on July 30, 2024

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.

Shane32 avatar Shane32 commented on July 30, 2024

Nice. πŸ‘ So close this now?

from parser.

sungam3r avatar sungam3r commented on July 30, 2024

OK to close.

from parser.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.