hasura / graphql-engine

Blazing fast, instant realtime GraphQL APIs on your DB with fine grained access control, also trigger webhooks on database events.
https://hasura.io
Apache License 2.0
31.03k stars 2.76k forks source link

tables.yaml alpha sort rules different for different devs #6950

Open TheFirstAvenger opened 3 years ago

TheFirstAvenger commented 3 years ago

Hasura version 1.3.3.

Array and Object relationships in table.yaml are following different alpha-sorting rules on my machine vs another persons machine. On my machine, when a change is made, all the names are sorted with all capitalized names ahead of all lower case names. In another persons machine, a change resorts all the names alphabetically irrespective of case. This causes the tables.yaml file to get reshuffled every time one of us modifies something in the hasura console, leading to diffs that bury the actual table.yaml changes we are applying in a list of the reshuffling changes.

For example, the below file snippet is how it appears on my machine:

- table:
    schema: public
    name: MyTable
  object_relationships:
  - name: SomeField
    ...
  - name: anotherField
   ...
  - name: thirdField
   ...

but when another person runs the console on their machine and makes a change that has nothing to do with these fields, the above code gets resorted to this:

- table:
    schema: public
    name: MyTable
  object_relationships:
  - name: anotherField
   ...
  - name: SomeField
    ...
  - name: thirdField
   ...

with the Capitalized SomeField moved down to where it appears in a case-insensitive sort.

scriptonist commented 3 years ago

@TheFirstAvenger are the two machines identical or different? Just trying to understand if the os / arch has anything to do with it.

TheFirstAvenger commented 3 years ago

I am on Catalina and the other dev is on Big Sur.

scriptonist commented 3 years ago

@TheFirstAvenger I was trying to reproduce this but unfortunately didn't succeed. If it's possible can you verify if the same happens on a Mac and Linux machine?