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

Bug - Schema names incongruent between actual vs. explorer web UI #109

Open
bordumb opened this issue Apr 18, 2021 · 2 comments
Open

Bug - Schema names incongruent between actual vs. explorer web UI #109

bordumb opened this issue Apr 18, 2021 · 2 comments

Comments

@bordumb
Copy link

bordumb commented Apr 18, 2021

Overview

Below are 2 examples I found where the schema name of a subgraph are incongruent between the actual subgraph (i.e. what can be queried with a connection) vs. what is shown on the explorer web UI.

Impact

  • It makes the subgraph look broken
  • It wastes time debugging the issue

Examples

indexers

image

This query will fail

For example, the query below would break, despite it being written to match what is shown on the explorer UI:

indexer_query = gql(
    """
    query {
        indexer {
            id,
            stakedTokens,
            delegatedStakeRatio
          }
    }
"""
)

This query will pass

indexer_query = gql(
    """
    query {
        indexers {
            id,
            stakedTokens,
            delegatedStakeRatio
          }
    }
"""
)

transactions

image

This query will fail

query = gql(
    """
    query {
        transaction {
            id,
            blockNumber
          }
    }
"""
)

This query will pass

query = gql(
    """
    query {
        transactions {
            id,
            blockNumber
          }
    }
"""
)

Proposal

  • Make sure that the schema named found in the Web UI is congruent (==) to what a user would query
  • Check all other subgraphs + schemas for similar issues (I only found 2 in a few minutes of working on this, so my assumption is it's a larger issue)
@bordumb
Copy link
Author

bordumb commented Apr 18, 2021

As an additional example, the query below doesn't work:

query = gql(
    """
    query {
        SignalTransactions {
            id, 
            blockNumber, 
            timestamp, 
            signer, 
            type, 
            signal, 
            tokens, 
            subgraphDeployment, 
            withdrawalFees
          }
    }
"""
)

I think most users will try the following due to the WebUI:

  • SignalTransactions
  • SignalTransaction

The correct schema to use is actually this:

  • signalTransactions

Proposal

If congruency between explorer UI and actual schema is not possible at this point, I strongly recommended making sample queries for 100% of the schema pieces to help guide users around the buggy naming

@juanmardefago
Copy link
Collaborator

@bordumb
Using the single query indexer instead of indexers requires you to specify the id of the Indexer entity you want to query, that's why it fails.

This is correct because by default indexers will return the first 100 results it finds for entities of type Indexer

query {
        indexers {
            id,
            stakedTokens,
            delegatedStakeRatio
          }
    }

This is currently incorrect, because by default it's expecting you to specify which specific entity you want to query

query {
        indexer {
            id,
            stakedTokens,
            delegatedStakeRatio
          }
    }

This is what a correct single query would look:

query {
        indexer(id:"0x....") {
            id,
            stakedTokens,
            delegatedStakeRatio
          }
    }

(of course you will need to replace "0x...." with whatever ID you want to query for, remember to use lowercase strings)

Also queries are expected to not be capitalized, so this is incorrect:

query {
        SignalTransactions {
            id, 
            blockNumber, 
            timestamp, 
            signer, 
            type, 
            signal, 
            tokens, 
            subgraphDeployment, 
            withdrawalFees
          }
    }

While this would be the correct query

query {
        signalTransactions {
            id, 
            blockNumber, 
            timestamp, 
            signer, 
            type, 
            signal, 
            tokens, 
            subgraphDeployment, 
            withdrawalFees
          }
    }

(the UI actually autocompletes that)

I don't think it's actually "buggy" naming, those are the actual naming conventions for queries for GraphQL, and their counterparts in the GraphQL schema "language" (which are the entities).

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

2 participants