Skip to content

Conversation

@jballe
Copy link
Contributor

@jballe jballe commented Apr 14, 2025

Use SitecoreGraphQlClientOptions for GraphQLHttpClient and support Configure

Description / Motivation

With this change it is possible to configure the GraphQLClient with Configure in DependencyInjection.

e.g. in a WebApplicationFactory call services.Configure<SitecoreGraphQlClientOptions>(cfg => cfg.HttpMessageHandler = _mockClientHandler);

The value is already consumed through dependency injection in eg. GraphQlSiteInfoService

The consequence is that any validation error are thrown upon first time the GraphQLHttpClient is resolved instead of on initial call to AddGraphQlClient during application setup.

Testing

  • The Unit & Intergration tests are passing.
  • I have added the necessary tests to cover my changes.

Terms

@jballe
Copy link
Contributor Author

jballe commented Apr 24, 2025

I have added a sample implementation using this configure feature at https://github.com/jballe/Sitecore-ASP.NET-SDK-IntegrationTest

@sc-ivanlieckens
Copy link
Member

The consequence is that any validation error are thrown upon first time the GraphQLHttpClient is resolved instead of on initial call to AddGraphQlClient during application setup.

Could you explain why this is desirable? I might be misunderstanding but doesn't this mean that a misconfiguration of the application is simply detectable much later rather than sooner?

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

Successfully merging this pull request may close these issues.

2 participants