Skip to content

Request: consistent sorting within exported GQL schema #989

@marshall007

Description

@marshall007

I'm submitting a ...

  • bug report
  • feature request
  • question

PostGraphile version: v4.3.2

Current behavior:

Since the auto-generated connections all take mostly the same parameters, git easily confuses the adding/removing of types in the schema as individual line changes. Taking this partial diff as an example, the artifactsToVehicles connection didn't actually change, it was the requirements connection that was added, but this is not immediately obvious:

diff --git a/cosmic.graphql b/cosmic.graphql
index ade3731..1ac8a04 100644
--- a/cosmic.graphql
+++ b/cosmic.graphql
@@ -197,6 +197,35 @@ type Artifact implements Node {
     condition: PartConfigurationCondition
   ): PartConfigurationsConnection!
 
+  """Reads and enables pagination through a set of `ArtifactsToVehicle`."""
+  artifactsToVehicles(
+    """Only read the first `n` values of the set."""
+    first: Int
+
+    """Only read the last `n` values of the set."""
+    last: Int
+
+    """
+    Skip the first `n` values from our `after` cursor, an alternative to cursor
+    based pagination. May not be used with `last`.
+    """
+    offset: Int
+
+    """Read all values in the set before (above) this cursor."""
+    before: Cursor
+
+    """Read all values in the set after (below) this cursor."""
+    after: Cursor
+
+    """The method to use when ordering `ArtifactsToVehicle`."""
+    orderBy: [ArtifactsToVehiclesOrderBy!] = [NATURAL]
+
+    """
+    A condition to be used in determining which values should be returned by the collection.
+    """
+    condition: ArtifactsToVehicleCondition
+  ): ArtifactsToVehiclesConnection!
+
   """Reads and enables pagination through a set of `ChangeSetApproval`."""
   changeSetApprovals(
     """Only read the first `n` values of the set."""
@@ -226,8 +255,8 @@ type Artifact implements Node {
     condition: ChangeSetApprovalCondition
   ): ChangeSetApprovalsConnection!
 
-  """Reads and enables pagination through a set of `ArtifactsToVehicle`."""
-  artifactsToVehicles(
+  """Reads and enables pagination through a set of `Requirement`."""
+  requirements(
     """Only read the first `n` values of the set."""
     first: Int
 
@@ -246,14 +275,35 @@ type Artifact implements Node {
     """Read all values in the set after (below) this cursor."""
     after: Cursor
 
-    """The method to use when ordering `ArtifactsToVehicle`."""
-    orderBy: [ArtifactsToVehiclesOrderBy!] = [NATURAL]
+    """The method to use when ordering `Requirement`."""
+    orderBy: [RequirementsOrderBy!] = [NATURAL]
 
     """
     A condition to be used in determining which values should be returned by the collection.
     """
-    condition: ArtifactsToVehicleCondition
-  ): ArtifactsToVehiclesConnection!
+    condition: RequirementCondition
+  ): RequirementsConnection!

Expected behavior:

When using exportGqlSchemaPath, the server should sort the generated output within each block so that the output remains mostly the same when types are added and removed from the schema.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions