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

Add Support for Hot Reload of GraphQL Schemas #2510

Merged
merged 14 commits into from
Jan 22, 2025

Conversation

abhishekkumams
Copy link
Contributor

@abhishekkumams abhishekkumams commented Jan 8, 2025

Why make this change?

  • Closes Hot Reload - GraphQL Schema Eviction and Regeneration #2431
  • This change is necessary to enable dynamic updates to GraphQL schemas without requiring a full application restart.
  • It enhances the developer experience by allowing schema changes to be reflected immediately during runtime, improving efficiency in development and deployment processes.

What is this change?

  • Addition of new constants in DabConfigEvents.cs for GraphQL schema events.
  • Updates to HotReloadEventHandler.cs to include handlers for GraphQL schema-related events.
  • Modifications in RuntimeConfigLoader.cs to ensure proper firing order of events for schema eviction and creation.
  • Updates to GraphQLSchemaCreator.cs to handle configuration changes and update runtime entities accordingly.
  • Modifications in Startup.cs to register hot reload event handlers and methods for refreshing and evicting the GraphQL schema.

How was this tested?

  • Integration Tests
  • Manual Tests

Sample Request(s)

hot-reload-gql.mp4

@abhishekkumams abhishekkumams marked this pull request as ready for review January 8, 2025 05:29
@abhishekkumams
Copy link
Contributor Author

/azp run

@abhishekkumams abhishekkumams added graphql 🔥Hot Reload Tasks related to DAB's Hot Reload feature proposal labels Jan 15, 2025
@abhishekkumams abhishekkumams added this to the 1.4 milestone Jan 15, 2025
@abhishekkumams
Copy link
Contributor Author

/azp run

Copy link
Contributor

@Aniruddh25 Aniruddh25 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this wonderful change! Excellent find, left some comments to address the status codes that we return, looks good otherwise.

@abhishekkumams
Copy link
Contributor Author

/azp run

Copy link
Contributor

@RubenCerna2079 RubenCerna2079 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@aaronburtle aaronburtle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good once the questions about internal server error being returned are resolved.

@abhishekkumams abhishekkumams merged commit 833521d into main Jan 22, 2025
7 checks passed
@abhishekkumams abhishekkumams deleted the dev/abhishekkuma/graphql-hot-reload branch January 22, 2025 03:43
Assert.IsTrue(SqlTestHelper.JsonStringsDeepEqual(expectedJson.RootElement.ToString(), items.ToString()));
}

/// <summary>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary end tag

{
// Re-add GraphQL services with updated config.
RuntimeConfig runtimeConfig = _configProvider!.GetConfig();
Console.WriteLine("Updating GraphQL service.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this Console.WriteLine?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
graphql 🔥Hot Reload Tasks related to DAB's Hot Reload feature proposal
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Hot Reload - GraphQL Schema Eviction and Regeneration
5 participants