Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autocompletion stopped working since upgrading webstrom to 2024.3 for big schema files #729

Open
ItaiYosephi opened this issue Nov 18, 2024 · 11 comments

Comments

@ItaiYosephi
Copy link

ItaiYosephi commented Nov 18, 2024

Describe the bug
Since upgrading Webstorm, there's no autocompletion, no red underline when trying to query for non existing fields, and so on.

UPDATE
Our schema file has a little over 51,000 lines.
If I randomly remove about a 1000 lines, the plugin started working as normal again...

Expected behavior
Schema should be detected properly, autocompletion should work,

Screenshots

Screenshot taken in Webstorm version 2024.2.4, and plugin version 242.21829.3.
Autocomplete is working, and securityScanSources has line through indicating it's deprecated

CleanShot 2024-11-18 at 13 02 11

Screenshot taken in Webstorm version 2024.3, and plugin version 243.21565.122:
Only __typename is autocompleted, and no line through

CleanShot 2024-11-18 at 13 04 24

Version and Environment Details
Operation system: MacOS
IDE name and version: Webstorm 2024.3
Plugin version: 243.21565.122

@ItaiYosephi ItaiYosephi changed the title Autocompletion stopped working since upgrading webstrom to 2024.3 Autocompletion stopped working since upgrading webstrom to 2024.3 for big schema files Nov 18, 2024
@vepanimas
Copy link
Collaborator

@ItaiYosephi Hi! Could you please open a GraphQL tool window and share the errors you see there?

@ItaiYosephi
Copy link
Author

ItaiYosephi commented Nov 25, 2024

@vepanimas
Hi, thanks for you response.
Seems like we've reached the limit.
updated in the registry to 6000, and seems to work now... I wonder if there's a better solution?
CleanShot 2024-11-25 at 09 51 23

@ItaiYosephi
Copy link
Author

@vepanimas hi, any update on that?

@vepanimas
Copy link
Collaborator

vepanimas commented Feb 11, 2025

Hi @ItaiYosephi! Could you please run grep -rE '^(schema|type|input|scalar|directive|enum|extend)' --include='*.graphql' . | wc -l in your repo and share the number?

We're working on optimizing schema building for some unusual projects containing hundreds of non-executable schemas, e.g. for testing purposes. These schemas aren't meant to be used but still significantly degrade performance, so we introduced this heuristic to address the issue. So far, your report is the only one after the latest release, so you probably have an unusually huge schema. Could you share some details about the project? Is it some open API which I can test too?

@vepanimas
Copy link
Collaborator

And one more question - are all the types in the same single file? If so, maybe we shouldn't count that case as an overflow.

@ItaiYosephi
Copy link
Author

Hi @vepanimas ,
The number is 4920.
Our project is big, and our schema grows bigger all the time. it's not open, so you can't test it.
The types are all in one file (we use codegen to generate it from the backend package).

@JG9A
Copy link

JG9A commented Mar 5, 2025

Hi

Hope it is OK I am jumping in here - I am trying to work with Atlassian graphql to fetch Jira only relevant part of the schema and I set this:

schema:
  - gen/schema.graphql:
     
extensions:
  endpoints:
    jira:
      url: https://pdc-amat-prod.atlassian.net/gateway/api/graphql
      headers:
        Authorization: Basic ${JIRA_API_TOKEN}
        X-ExperimentalApi: JiraIssueSearch
      introspect: true

I am getting the limit error and I ran
grep -rE '^(schema|type|input|scalar|directive|enum|extend)' --include='*.graphql' . | wc -l

I am getting 10859 - is there a way to filter the fetched schema somehow to relevant part only?

I tried this:

schema:
  - gen/schema.graphql:
      include:
        - "Issue*"
        - "Jira*"
        - "Project*"
        - "User*"
        - "Team*"
        - "Board*"
        - "Sprint*"
        - "WorkLog*"
        - "Comment*"
        - "Task*"
        - "Priority*"
        - "Status*"
      exclude:
        - "*Confluence*"
        - "*Bitbucket*"
        - "*Page*"
        - "*Blog*"
        - "*Content*"
        - "*Space*"
        - "*Notification*"
        - "*WebPanel*"
        - "*WebItem*"

but the result is the same

Thanks

@vepanimas
Copy link
Collaborator

vepanimas commented Mar 5, 2025

@JG9A oh, that's a huge schema, I'll look at how it performs. For now, you can change a registry key to increase the predefined limit graphql.schema.size.definitions.limit:

Image

Also, I noticed that you have an extra colon at the end of the schema path, looks like a typo:

schema:
  - gen/schema.graphql:     # <-- a colon here it not needed
     
extensions:
  endpoints:
    jira:
      url: https://pdc-amat-prod.atlassian.net/gateway/api/graphql
      headers:
        Authorization: Basic ${JIRA_API_TOKEN}
        X-ExperimentalApi: JiraIssueSearch
      introspect: true

And you can't include or exclude specific types from a schema in the graphql.config, include and exclude keys are specified for files, not for types.

@vepanimas
Copy link
Collaborator

I'll remove a limit for single files. The intent was not to add up types from multiple different files since, in most cases, they are not intended to be combined into a single executable schema.

@JG9A
Copy link

JG9A commented Mar 6, 2025

@vepanimas thanks for the quick response.

Should I expect the removal of the limit in the next plugin version?

Did you tried to use Atlasian GraphQL? I am trying to know if I am doing something wrong and there is a way to create a reduce schema ( not manually) or it is an issue on their side.

Again thanks for the help.

@vepanimas
Copy link
Collaborator

vepanimas commented Mar 10, 2025

@JG9A

Should I expect the removal of the limit in the next plugin version?

I'll change the logic somehow, probably increasing the limit and skipping the checks for cases with single generated schemas. For now, you can just change a registry setting to any number you need.

Did you tried to use Atlasian GraphQL? I am trying to know if I am doing something wrong and there is a way to create a reduce schema ( not manually) or it is an issue on their side.

I don't see any issues with the schema, it's a problem on the plugin's side.

WEB-72019 GraphQL: improve perf optimization for huge schemas

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants