question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Schema always sorted

See original GitHub issue

Describe the bug Schema is always sorted regardless of the sort config.

To Reproduce Steps to reproduce the behavior:

https://codesandbox.io/s/gql-codegen-sort-5my7k

Note that the config does not set config: true, but the generated is still sorted.

  1. My GraphQL schema:
type Query {
    user(id: ID!): User!
}

type User {
    id: ID!
    username: String!
    email: String!
}
  1. My GraphQL operations:
query user {
    user(id: 1) {
        id
        username
        email
    }
}
  1. My codegen.yml config file:
schema: schema.graphql
documents: document.graphql
generates:
  types.ts:
    plugins:
      - typescript
      - typescript-operations

Expected behavior I expect that the output won’t be sorted because sort is not true in the config.

Environment:

  • OS: Codesandbox
  • @graphql-codegen/add: @2.0.2
  • @graphql-codegen/cli: @2.2.0
  • @graphql-codegen/typescript: @1.21.0
  • @graphql-codegen/typescript-operations: @1.17.14
  • NodeJS: v14.17.6

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
ardatancommented, Sep 10, 2021

This change has been done to give more consistent results. I don’t think sorting is an issue, bug or a breaking change. It’s been documented here; https://github.com/dotansimha/graphql-code-generator/blob/master/packages/graphql-codegen-cli/CHANGELOG.md#minor-changes You can disable it with sort: false. Closing this issue.

0reactions
okbytescommented, Sep 10, 2021

@canac I resolved this problem by reverting these packages to the versions below:

@graphql-codegen/cli”: “1.21.8”, “@graphql-codegen/typescript-operations”: “1.18.4”,

Read more comments on GitHub >

github_iconTop Results From Across the Web

DB Schema: Maintaining Item Order - Stack Overflow
I see three alternatives: sort order field in the list item table. Normally the best choice: Simple and does what you need.
Read more >
Schema Browser - Sort - Toad for Oracle - Beta
In the Schema Browser Treeview mode, sorting is always done by Oracle. Try this in the editor and see what the sort order...
Read more >
Config mappings are sorted the way they are defined in their ...
It is always recommended to upgrade Drupal versions in their own branches ... are now sorted according to the order defined in their...
Read more >
Properties order · Issue #7 · json-schema-org/json ... - GitHub
Keep in mind that this extension works like "prefered-sort-order", it does not act as a validation. Schema can still be valid regardless the ......
Read more >
Schema design best practices | Cloud Bigtable Documentation
Keep in mind that row keys are sorted lexicographically. Don't use a timestamp by itself or at the beginning of a row key,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found