0
0
GraphQLquery~30 mins

GraphQL IDE extensions - Mini Project: Build & Apply

Choose your learning style9 modes available
Building a Simple GraphQL IDE Extension
📖 Scenario: You are creating a simple GraphQL IDE extension that helps users by storing and managing a list of saved GraphQL queries. This will simulate a small database of queries inside the extension.
🎯 Goal: Build a small in-memory database structure to hold saved GraphQL queries, add a configuration for maximum saved queries, implement a function to add queries only if under the limit, and finalize the extension setup with a metadata object.
📋 What You'll Learn
Create a dictionary called savedQueries with three exact entries: "GetUser": "query { user { id name } }", "ListPosts": "query { posts { id title } }", and "GetComments": "query { comments { id content } }".
Add a variable called maxQueries and set it to 5.
Write a function called addQuery that takes name and query parameters and adds the query to savedQueries only if the number of saved queries is less than maxQueries.
Create a final object called extensionMetadata with keys name set to "SimpleGraphQLIDE" and version set to "1.0.0".
💡 Why This Matters
🌍 Real World
GraphQL IDE extensions often need to store user queries for quick access. This project simulates managing such a small database inside the extension.
💼 Career
Understanding how to manage data storage and configuration in extensions or applications is a key skill for software developers working with developer tools or IDE plugins.
Progress0 / 4 steps
1
Create the initial saved queries dictionary
Create a dictionary called savedQueries with these exact entries: "GetUser": "query { user { id name } }", "ListPosts": "query { posts { id title } }", and "GetComments": "query { comments { id content } }".
GraphQL
Need a hint?

Use curly braces {} to create a dictionary and add the exact keys and values as strings.

2
Add a maximum queries configuration
Add a variable called maxQueries and set it to 5.
GraphQL
Need a hint?

Just create a variable named maxQueries and assign the number 5 to it.

3
Write a function to add queries with limit check
Write a function called addQuery that takes parameters name and query. Inside the function, add the query to savedQueries only if the number of saved queries is less than maxQueries.
GraphQL
Need a hint?

Use len(savedQueries) to check the current number of queries before adding a new one.

4
Add extension metadata object
Create a final object called extensionMetadata with keys name set to "SimpleGraphQLIDE" and version set to "1.0.0".
GraphQL
Need a hint?

Create a dictionary with the exact keys and values as strings.