Skip to content

Conversation

@mbcrawfo
Copy link
Contributor

I discovered the library today, but it took a while to figure out how to set it up to work with the IGraphQLBuilder that GraphQL.Net now provides for DI setup. Once I got it working, I realized that the configuration could be wrapped in a single method working with the builder. Also, when working with DI we don't actually need a validator cache (the user registers their validators with DI, we query DI to find out what validators are available), allowing setup to be simplified even more.

Changes in this PR:

  • Add default builder configuration method that uses DI to resolve validators.
  • Add configuration overload method if the user does not want to use DI and wishes to provider an IValidatorCache.
  • Add ValidatorServiceProviderCache which doesn't actually hold a cache, it just does lookups in the service provider to see what validators are available. IMO this should deprecate ValidatorServiceCache, but I wasn't able to mark it as obsolete due to obsolete warnings being treated as errors.
  • Update readme to describe the new simplified configuration.

When using the DI service provider we don't need to maintain a cache of the available validator types.  Querying the the service provider for a list of IValidator<T> will give us all matching validators.
@SimonCropp
Copy link
Owner

can u add some tests for this

@mbcrawfo
Copy link
Contributor Author

mbcrawfo commented May 9, 2023

@SimonCropp the test project fails to build because "markdownsnippets" returns errors about the readme containing invalid words "you" and "your". I've searched the documentation in this project and looked at the markdownsnippets project. It's rather confusing why a tool that (according to its readme) is for "extracting snippets from code files and merging them into markdown documents" cares about the wording of the document? That aside, I can't find anything to indicate what validation rules are being applied to the readme or what language it wants.

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