From 8c0361cbbb1e4d17f6e902c2defbab954ae1b28e Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 4 Sep 2024 17:06:49 +0300 Subject: [PATCH 1/8] Update packages and tools Move dotnet tools to root Add editorconfig Add readme to package Update gitignore Code ref and formatting --- .../.config => .config}/dotnet-tools.json | 5 +- .editorconfig | 307 ++++++++++++++++++ .gitignore | 130 +++++++- .../GraphHealthChecks.Tests.csproj | 60 ++-- .../GraphHealthChecksFactoriesTests.cs | 10 +- .../GraphHealthExtensionsTests.cs | 126 ++++--- .../GraphQLHealthCheckTests.cs | 237 +++++--------- ...LHealthCheckTests.ILoggerGeneralError.snap | 8 + ...raphQLHealthCheckTests.ILoggerHealthy.snap | 6 + ...QLHealthCheckTests.ILoggerHealthyAuth.snap | 6 + ...althCheckTests.ILoggerUnhealthySchema.snap | 8 + ...eckTests.ILoggerUnhealthySchemaNoAuth.snap | 8 + ...ggerUnhealthySchemaNoAuthGeneralError.snap | 8 + ...HealthCheckTests.NoLoggerGeneralError.snap | 8 + ...aphQLHealthCheckTests.NoLoggerHealthy.snap | 6 + ...lthCheckTests.NoLoggerUnhealthySchema.snap | 8 + GraphHealthChecks.sln | 4 + GraphHealthChecks/GraphHealthCheck.cs | 32 +- GraphHealthChecks/GraphHealthChecks.csproj | 48 +-- .../GraphHealthChecksFactories.cs | 14 +- GraphHealthChecks/GraphHealthExtensions.cs | 11 +- GraphHealthChecks/README.md | 80 +++++ GraphHealthChecks/Usings.cs | 10 + NOTES.md | 9 +- README.md | 30 +- global.json | 6 + 26 files changed, 867 insertions(+), 318 deletions(-) rename {GraphHealthChecks.Tests/.config => .config}/dotnet-tools.json (70%) create mode 100644 .editorconfig create mode 100644 GraphHealthChecks.Tests/__snapshots__/GraphQLHealthCheckTests.ILoggerGeneralError.snap create mode 100644 GraphHealthChecks.Tests/__snapshots__/GraphQLHealthCheckTests.ILoggerHealthy.snap create mode 100644 GraphHealthChecks.Tests/__snapshots__/GraphQLHealthCheckTests.ILoggerHealthyAuth.snap create mode 100644 GraphHealthChecks.Tests/__snapshots__/GraphQLHealthCheckTests.ILoggerUnhealthySchema.snap create mode 100644 GraphHealthChecks.Tests/__snapshots__/GraphQLHealthCheckTests.ILoggerUnhealthySchemaNoAuth.snap create mode 100644 GraphHealthChecks.Tests/__snapshots__/GraphQLHealthCheckTests.ILoggerUnhealthySchemaNoAuthGeneralError.snap create mode 100644 GraphHealthChecks.Tests/__snapshots__/GraphQLHealthCheckTests.NoLoggerGeneralError.snap create mode 100644 GraphHealthChecks.Tests/__snapshots__/GraphQLHealthCheckTests.NoLoggerHealthy.snap create mode 100644 GraphHealthChecks.Tests/__snapshots__/GraphQLHealthCheckTests.NoLoggerUnhealthySchema.snap create mode 100644 GraphHealthChecks/README.md create mode 100644 GraphHealthChecks/Usings.cs create mode 100644 global.json diff --git a/GraphHealthChecks.Tests/.config/dotnet-tools.json b/.config/dotnet-tools.json similarity index 70% rename from GraphHealthChecks.Tests/.config/dotnet-tools.json rename to .config/dotnet-tools.json index 9b4de66..a061aac 100644 --- a/GraphHealthChecks.Tests/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,10 +3,11 @@ "isRoot": true, "tools": { "dotnet-reportgenerator-globaltool": { - "version": "5.2.0", + "version": "5.3.9", "commands": [ "reportgenerator" - ] + ], + "rollForward": false } } } \ No newline at end of file diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..322d8cd --- /dev/null +++ b/.editorconfig @@ -0,0 +1,307 @@ +# Remove the line below if you want to inherit .editorconfig settings from higher directories +# @see: https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/code-style-rule-options +root = true + +[*] +# New line preferences +end_of_line = crlf + +[*.{json,graphql,css}] +indent_size = 2 +indent_style = space +tab_width = 2 + +# C# / Razor files +[*.cs] + +#### Core EditorConfig Options #### + +# Indentation and spacing +indent_size = 4 +indent_style = space +tab_width = 4 + +# New line preferences +insert_final_newline = true + +#### .NET Coding Conventions #### + +# Organize usings +dotnet_separate_import_directive_groups = false +dotnet_sort_system_directives_first = false +file_header_template = unset + +# this. and Me. preferences +dotnet_style_qualification_for_event = false +dotnet_style_qualification_for_field = false +dotnet_style_qualification_for_method = false +dotnet_style_qualification_for_property = false + +# Language keywords vs BCL types preferences +dotnet_style_predefined_type_for_locals_parameters_members = true +dotnet_style_predefined_type_for_member_access = true + +# Parentheses preferences +dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity +dotnet_style_parentheses_in_other_binary_operators = always_for_clarity +dotnet_style_parentheses_in_other_operators = never_if_unnecessary +dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity + +# Modifier preferences +dotnet_style_require_accessibility_modifiers = for_non_interface_members + +# Expression-level preferences +dotnet_style_coalesce_expression = true +dotnet_style_collection_initializer = true +dotnet_style_explicit_tuple_names = true +dotnet_style_namespace_match_folder = true +dotnet_style_null_propagation = true +dotnet_style_object_initializer = true +dotnet_style_operator_placement_when_wrapping = beginning_of_line +dotnet_style_prefer_auto_properties = true +dotnet_style_prefer_collection_expression = when_types_loosely_match +dotnet_style_prefer_compound_assignment = true +dotnet_style_prefer_conditional_expression_over_assignment = true +dotnet_style_prefer_conditional_expression_over_return = true +dotnet_style_prefer_foreach_explicit_cast_in_source = when_strongly_typed +dotnet_style_prefer_inferred_anonymous_type_member_names = true +dotnet_style_prefer_inferred_tuple_names = true +dotnet_style_prefer_is_null_check_over_reference_equality_method = true +dotnet_style_prefer_simplified_boolean_expressions = true +dotnet_style_prefer_simplified_interpolation = true + +# Field preferences +dotnet_style_readonly_field = true + +# Parameter preferences +dotnet_code_quality_unused_parameters = all:silent + +# Suppression preferences +dotnet_remove_unnecessary_suppression_exclusions = none + +# New line preferences +dotnet_style_allow_multiple_blank_lines_experimental = true +dotnet_style_allow_statement_immediately_after_block_experimental = true + +#### C# Coding Conventions #### + +# var preferences +csharp_style_var_elsewhere = true +csharp_style_var_for_built_in_types = true +csharp_style_var_when_type_is_apparent = true + +# Expression-bodied members +csharp_style_expression_bodied_accessors = true +csharp_style_expression_bodied_constructors = false +csharp_style_expression_bodied_indexers = true +csharp_style_expression_bodied_lambdas = true +csharp_style_expression_bodied_local_functions = true +csharp_style_expression_bodied_methods = true +csharp_style_expression_bodied_operators = true +csharp_style_expression_bodied_properties = true + +# Pattern matching preferences +csharp_style_pattern_matching_over_as_with_null_check = true +csharp_style_pattern_matching_over_is_with_cast_check = true +csharp_style_prefer_extended_property_pattern = true +csharp_style_prefer_not_pattern = true +csharp_style_prefer_pattern_matching = true +csharp_style_prefer_switch_expression = true + +# Null-checking preferences +csharp_style_conditional_delegate_call = true + +# Modifier preferences +csharp_prefer_static_local_function = true +csharp_preferred_modifier_order = public, private, protected, internal, file, static, extern, new, virtual, abstract, sealed, override, readonly, unsafe, required, volatile, async +csharp_style_prefer_readonly_struct = true +csharp_style_prefer_readonly_struct_member = true + +# Code-block preferences +csharp_prefer_braces = when_multiline +csharp_prefer_simple_using_statement = true +csharp_style_namespace_declarations = file_scoped +csharp_style_prefer_method_group_conversion = true +csharp_style_prefer_primary_constructors = true +csharp_style_prefer_top_level_statements = true + +# Expression-level preferences +csharp_prefer_simple_default_expression = true +csharp_style_deconstructed_variable_declaration = true +csharp_style_implicit_object_creation_when_type_is_apparent = true +csharp_style_inlined_variable_declaration = true +csharp_style_prefer_index_operator = true +csharp_style_prefer_local_over_anonymous_function = true +csharp_style_prefer_null_check_over_type_check = true +csharp_style_prefer_range_operator = true +csharp_style_prefer_tuple_swap = true +csharp_style_prefer_utf8_string_literals = true +csharp_style_throw_expression = true +csharp_style_unused_value_assignment_preference = discard_variable +csharp_style_unused_value_expression_statement_preference = discard_variable + +# 'using' directive preferences +csharp_using_directive_placement = outside_namespace + +# New line preferences +csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true +csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = true +csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = true +csharp_style_allow_blank_lines_between_consecutive_braces_experimental = true +csharp_style_allow_embedded_statements_on_same_line_experimental = true + +#### C# Formatting Rules #### + +# New line preferences +csharp_new_line_before_catch = true +csharp_new_line_before_else = true +csharp_new_line_before_finally = true +csharp_new_line_before_members_in_anonymous_types = true +csharp_new_line_before_members_in_object_initializers = true +csharp_new_line_before_open_brace = all +csharp_new_line_between_query_expression_clauses = true + +# Indentation preferences +csharp_indent_block_contents = true +csharp_indent_braces = false +csharp_indent_case_contents = true +csharp_indent_case_contents_when_block = true +csharp_indent_labels = one_less_than_current +csharp_indent_switch_labels = true + +# Space preferences +csharp_space_after_cast = false +csharp_space_after_colon_in_inheritance_clause = true +csharp_space_after_comma = true +csharp_space_after_dot = false +csharp_space_after_keywords_in_control_flow_statements = true +csharp_space_after_semicolon_in_for_statement = true +csharp_space_around_binary_operators = before_and_after +csharp_space_around_declaration_statements = false +csharp_space_before_colon_in_inheritance_clause = true +csharp_space_before_comma = false +csharp_space_before_dot = false +csharp_space_before_open_square_brackets = false +csharp_space_before_semicolon_in_for_statement = false +csharp_space_between_empty_square_brackets = false +csharp_space_between_method_call_empty_parameter_list_parentheses = false +csharp_space_between_method_call_name_and_opening_parenthesis = false +csharp_space_between_method_call_parameter_list_parentheses = false +csharp_space_between_method_declaration_empty_parameter_list_parentheses = false +csharp_space_between_method_declaration_name_and_open_parenthesis = false +csharp_space_between_method_declaration_parameter_list_parentheses = false +csharp_space_between_parentheses = false +csharp_space_between_square_brackets = false + +# Wrapping preferences +csharp_preserve_single_line_blocks = true +csharp_preserve_single_line_statements = true + +#### Naming styles #### + +# Naming rules + +dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion +dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface +dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i + +dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion +dotnet_naming_rule.types_should_be_pascal_case.symbols = types +dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case + +dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion +dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members +dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case + +## Define the 'private_fields_should_be_underscored' naming rule +dotnet_naming_rule.private_fields_should_be_underscored.severity = suggestion +dotnet_naming_rule.private_fields_should_be_underscored.symbols = private_fields +dotnet_naming_rule.private_fields_should_be_underscored.style = underscored + +## Define the 'private_static_fields_should_be_underscored' naming rule +dotnet_naming_rule.private_static_fields_should_be_underscored.severity = suggestion +dotnet_naming_rule.private_static_fields_should_be_underscored.symbols = private_static_fields +dotnet_naming_rule.private_static_fields_should_be_underscored.style = underscored + +## Define the 'private_constants_should_be_underscored' naming rule +dotnet_naming_rule.private_constants_should_be_underscored.severity = suggestion +dotnet_naming_rule.private_constants_should_be_underscored.symbols = private_constants +dotnet_naming_rule.private_constants_should_be_underscored.style = underscored + +## Define the 'public_constants_should_be_pascal_case' naming rule +dotnet_naming_rule.public_constants_should_be_pascal_case.severity = suggestion +dotnet_naming_rule.public_constants_should_be_pascal_case.symbols = public_constants +dotnet_naming_rule.public_constants_should_be_pascal_case.style = pascal_case + +# Symbol specifications + +dotnet_naming_symbols.interface.applicable_kinds = interface +dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.interface.required_modifiers = + +dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum +dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.types.required_modifiers = + +dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method +dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.non_field_members.required_modifiers = + +## Define the 'private_fields' symbol group +dotnet_naming_symbols.private_fields.applicable_kinds = field +dotnet_naming_symbols.private_fields.applicable_accessibilities = private + +## Define the 'private_static_fields' symbol group +dotnet_naming_symbols.private_static_fields.applicable_kinds = field +dotnet_naming_symbols.private_static_fields.applicable_accessibilities = private +dotnet_naming_symbols.private_static_fields.required_modifiers = static + +## Define the 'private_constants' symbol group +dotnet_naming_symbols.private_constants.applicable_kinds = field +dotnet_naming_symbols.private_constants.applicable_accessibilities = private +dotnet_naming_symbols.private_constants.required_modifiers = const + +## Define the 'public_constants' symbol group +dotnet_naming_symbols.public_constants.applicable_kinds = field +dotnet_naming_symbols.public_constants.applicable_accessibilities = public +dotnet_naming_symbols.public_constants.required_modifiers = const + +# Naming styles + +dotnet_naming_style.pascal_case.required_prefix = +dotnet_naming_style.pascal_case.required_suffix = +dotnet_naming_style.pascal_case.word_separator = +dotnet_naming_style.pascal_case.capitalization = pascal_case + +dotnet_naming_style.begins_with_i.required_prefix = I +dotnet_naming_style.begins_with_i.required_suffix = +dotnet_naming_style.begins_with_i.word_separator = +dotnet_naming_style.begins_with_i.capitalization = pascal_case + +## Define the 'underscored' naming style +dotnet_naming_style.underscored.capitalization = camel_case +dotnet_naming_style.underscored.required_prefix = _ + +# ReSharper +resharper_arrange_object_creation_when_type_not_evident_highlighting = none +resharper_redundant_argument_default_value_highlighting = none +resharper_csharp_braces_for_dowhile = required_for_multiline_statement +resharper_csharp_braces_for_fixed = required_for_multiline_statement +resharper_csharp_braces_for_for = required_for_multiline_statement +resharper_csharp_braces_for_foreach = required_for_multiline_statement +resharper_csharp_braces_for_lock = required_for_multiline_statement +resharper_csharp_braces_for_using = required_for_multiline_statement +resharper_csharp_braces_for_while = required_for_multiline_statement +resharper_csharp_braces_for_ifelse = required_for_multiline_statement +resharper_csharp_empty_block_style = together +resharper_csharp_max_array_initializer_elements_on_line = 1 +resharper_csharp_place_attribute_on_same_line = false +resharper_csharp_place_field_attribute_on_same_line = false +resharper_csharp_wrap_object_and_collection_initializer_style = chop_always +resharper_csharp_wrap_primary_constructor_parameters_style = chop_if_long +resharper_csharp_wrap_arguments_style = chop_if_long +resharper_csharp_wrap_chained_method_calls = chop_if_long +resharper_csharp_wrap_before_first_method_call = true +resharper_csharp_wrap_after_property_in_chained_method_calls = true +resharper_csharp_indent_raw_literal_string = do_not_change +resharper_csharp_max_line_length = 200 \ No newline at end of file diff --git a/.gitignore b/.gitignore index 9491a2f..18cabf6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,10 @@ ## Ignore Visual Studio temporary files, build results, and ## files generated by popular Visual Studio add-ons. ## -## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore +## Get latest from `dotnet new gitignore` + +# dotenv files +.env # User-specific files *.rsuser @@ -29,7 +32,6 @@ x86/ bld/ [Bb]in/ [Oo]bj/ -[Oo]ut/ [Ll]og/ [Ll]ogs/ @@ -58,11 +60,14 @@ dlldata.c # Benchmark Results BenchmarkDotNet.Artifacts/ -# .NET Core +# .NET project.lock.json project.fragment.lock.json artifacts/ +# Tye +.tye/ + # ASP.NET Scaffolding ScaffoldingReadMe.txt @@ -91,6 +96,7 @@ StyleCopReport.xml *.tmp_proj *_wpftmp.csproj *.log +*.tlog *.vspscc *.vssscc .builds @@ -146,6 +152,7 @@ _TeamCity* coverage*.json coverage*.xml coverage*.info +CoverageResults/ # Visual Studio code coverage results *.coverage @@ -294,6 +301,17 @@ node_modules/ # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) *.vbw +# Visual Studio 6 auto-generated project file (contains which files were open etc.) +*.vbp + +# Visual Studio 6 workspace and project file (working project files containing files to include in project) +*.dsw +*.dsp + +# Visual Studio 6 technical files +*.ncb +*.aps + # Visual Studio LightSwitch build output **/*.HTMLClient/GeneratedArtifacts **/*.DesktopClient/GeneratedArtifacts @@ -350,6 +368,9 @@ ASALocalRun/ # Local History for Visual Studio .localhistory/ +# Visual Studio History (VSHistory) files +.vshistory/ + # BeatPulse healthcheck temp database healthchecksdb @@ -360,4 +381,105 @@ MigrationBackup/ .ionide/ # Fody - auto-generated XML schema -FodyWeavers.xsd \ No newline at end of file +FodyWeavers.xsd + +# VS Code files for those working on multiple tools +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +*.code-workspace + +# Local History for Visual Studio Code +.history/ + +# Windows Installer files from build outputs +*.cab +*.msi +*.msix +*.msm +*.msp + +# JetBrains Rider +*.sln.iml +.idea + +## +## Visual studio for Mac +## + + +# globs +Makefile.in +*.userprefs +*.usertasks +config.make +config.status +aclocal.m4 +install-sh +autom4te.cache/ +*.tar.gz +tarballs/ +test-results/ + +# Mac bundle stuff +*.dmg +*.app + +# content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore +# Windows thumbnail cache files +Thumbs.db +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +# Vim temporary swap files +*.swp diff --git a/GraphHealthChecks.Tests/GraphHealthChecks.Tests.csproj b/GraphHealthChecks.Tests/GraphHealthChecks.Tests.csproj index 997e31f..2592d16 100644 --- a/GraphHealthChecks.Tests/GraphHealthChecks.Tests.csproj +++ b/GraphHealthChecks.Tests/GraphHealthChecks.Tests.csproj @@ -1,37 +1,35 @@ - - net6.0;net8.0 - enable - enable - false - true - + + net8.0 + enable + enable + false + true + - - - - - - - - - - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - + + + + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + - - - + + + diff --git a/GraphHealthChecks.Tests/GraphHealthChecksFactoriesTests.cs b/GraphHealthChecks.Tests/GraphHealthChecksFactoriesTests.cs index 5b2b27d..bad9bcb 100644 --- a/GraphHealthChecks.Tests/GraphHealthChecksFactoriesTests.cs +++ b/GraphHealthChecks.Tests/GraphHealthChecksFactoriesTests.cs @@ -4,11 +4,6 @@ namespace GraphHealthChecks.Tests; public class GraphHealthChecksFactoriesTests { - public class Query - { - public string Name => "Hello"; - } - [Fact(DisplayName = "GraphHealthChecksFactories - GraphHealthCheckFactoryWithNoLogger - Custom Schema")] public void GraphHealthCheckFactoryWithNoLoggerCustomSchema() { @@ -102,4 +97,9 @@ public void GraphHealthCheckFactoryWithLoggerFnDefaultSchema() Assert.IsAssignableFrom(result); Assert.Null((result as GraphHealthCheck)?.Schema); } + + public class Query + { + public string Name => "Hello"; + } } diff --git a/GraphHealthChecks.Tests/GraphHealthExtensionsTests.cs b/GraphHealthChecks.Tests/GraphHealthExtensionsTests.cs index 4537aad..56d3078 100644 --- a/GraphHealthChecks.Tests/GraphHealthExtensionsTests.cs +++ b/GraphHealthChecks.Tests/GraphHealthExtensionsTests.cs @@ -13,12 +13,12 @@ public void MultipleInstancesSeparateNamesAndSchemas() new ServiceCollection() .AddLogging() .AddHealthChecks() - .AddGraphHealthWithNoLogger(healthName: "health1", schemaName: "schema1") - .AddGraphHealthWithNoLogger(healthName: "health2", schemaName: "schema2") - .AddGraphHealthWithILogger(healthName: "health3", schemaName: "schema3") - .AddGraphHealthWithILogger(healthName: "health4", schemaName: "schema4") - .AddGraphHealthWithILoggerFactory(healthName: "health5", schemaName: "schema5") - .AddGraphHealthWithILoggerFactory(healthName: "health6", schemaName: "schema6") + .AddGraphHealthWithNoLogger("health1", "schema1") + .AddGraphHealthWithNoLogger("health2", "schema2") + .AddGraphHealthWithILogger("health3", "schema3") + .AddGraphHealthWithILogger("health4", "schema4") + .AddGraphHealthWithILoggerFactory("health5", "schema5") + .AddGraphHealthWithILoggerFactory("health6", "schema6") .Services .BuildServiceProvider() .GetRequiredService>() @@ -27,17 +27,17 @@ public void MultipleInstancesSeparateNamesAndSchemas() Assert.Equal( options.Registrations.Count, new[] - { - "health1", - "health2", - "health3", - "health4", - "health5", - "health6" - } - .Intersect(options.Registrations.Select(x => x.Name)) - .Distinct() - .Count() + { + "health1", + "health2", + "health3", + "health4", + "health5", + "health6" + } + .Intersect(options.Registrations.Select(x => x.Name)) + .Distinct() + .Count() ); } @@ -47,14 +47,13 @@ public void MultipleInstancesSeparateNamesAndSameSchema() var options = new ServiceCollection() .AddLogging() - .AddHealthChecks() - .AddGraphHealthWithNoLogger(healthName: "health1", schemaName: "schema") - .AddGraphHealthWithNoLogger(healthName: "health2", schemaName: "schema") - .AddGraphHealthWithILogger(healthName: "health3", schemaName: "schema") - .AddGraphHealthWithILogger(healthName: "health4", schemaName: "schema") - .AddGraphHealthWithILoggerFactory(healthName: "health5", schemaName: "schema") - .AddGraphHealthWithILoggerFactory(healthName: "health6", schemaName: "schema") + .AddGraphHealthWithNoLogger("health1", "schema") + .AddGraphHealthWithNoLogger("health2", "schema") + .AddGraphHealthWithILogger("health3", "schema") + .AddGraphHealthWithILogger("health4", "schema") + .AddGraphHealthWithILoggerFactory("health5", "schema") + .AddGraphHealthWithILoggerFactory("health6", "schema") .Services .BuildServiceProvider() .GetRequiredService>() @@ -63,17 +62,17 @@ public void MultipleInstancesSeparateNamesAndSameSchema() Assert.Equal( options.Registrations.Count, new[] - { - "health1", - "health2", - "health3", - "health4", - "health5", - "health6" - } - .Intersect(options.Registrations.Select(x => x.Name)) - .Distinct() - .Count() + { + "health1", + "health2", + "health3", + "health4", + "health5", + "health6" + } + .Intersect(options.Registrations.Select(x => x.Name)) + .Distinct() + .Count() ); } @@ -83,14 +82,13 @@ public void MultipleInstancesSeparateNamesAndSameSchemaDefault() var options = new ServiceCollection() .AddLogging() - .AddHealthChecks() - .AddGraphHealthWithNoLogger(healthName: "health1") - .AddGraphHealthWithNoLogger(healthName: "health2") - .AddGraphHealthWithILogger(healthName: "health3") - .AddGraphHealthWithILogger(healthName: "health4") - .AddGraphHealthWithILoggerFactory(healthName: "health5") - .AddGraphHealthWithILoggerFactory(healthName: "health6") + .AddGraphHealthWithNoLogger("health1") + .AddGraphHealthWithNoLogger("health2") + .AddGraphHealthWithILogger("health3") + .AddGraphHealthWithILogger("health4") + .AddGraphHealthWithILoggerFactory("health5") + .AddGraphHealthWithILoggerFactory("health6") .Services .BuildServiceProvider() .GetRequiredService>() @@ -99,17 +97,17 @@ public void MultipleInstancesSeparateNamesAndSameSchemaDefault() Assert.Equal( options.Registrations.Count, new[] - { - "health1", - "health2", - "health3", - "health4", - "health5", - "health6" - } - .Intersect(options.Registrations.Select(x => x.Name)) - .Distinct() - .Count() + { + "health1", + "health2", + "health3", + "health4", + "health5", + "health6" + } + .Intersect(options.Registrations.Select(x => x.Name)) + .Distinct() + .Count() ); } @@ -119,14 +117,13 @@ public void MultipleInstancesSameNameAndSchema() var options = new ServiceCollection() .AddLogging() - .AddHealthChecks() - .AddGraphHealthWithNoLogger(healthName: "health") - .AddGraphHealthWithNoLogger(healthName: "health") - .AddGraphHealthWithILogger(healthName: "health") - .AddGraphHealthWithILogger(healthName: "health") - .AddGraphHealthWithILoggerFactory(healthName: "health") - .AddGraphHealthWithILoggerFactory(healthName: "health") + .AddGraphHealthWithNoLogger("health") + .AddGraphHealthWithNoLogger("health") + .AddGraphHealthWithILogger("health") + .AddGraphHealthWithILogger("health") + .AddGraphHealthWithILoggerFactory("health") + .AddGraphHealthWithILoggerFactory("health") .Services .BuildServiceProvider() .GetRequiredService>() @@ -147,7 +144,6 @@ public void MultipleInstancesSameNameDefaultAndSchemaDefault() var options = new ServiceCollection() .AddLogging() - .AddHealthChecks() .AddGraphHealthWithNoLogger() .AddGraphHealthWithNoLogger() @@ -196,7 +192,7 @@ public void AddGraphHealthWithNoLoggerCustomHealthName() var options = new ServiceCollection() .AddHealthChecks() - .AddGraphHealthWithNoLogger(healthName: "Graph") + .AddGraphHealthWithNoLogger("Graph") .Services .BuildServiceProvider() .GetRequiredService>() @@ -240,7 +236,7 @@ public void AddGraphHealthWithILoggerCustomHealthName() new ServiceCollection() .AddLogging() .AddHealthChecks() - .AddGraphHealthWithILogger(healthName: "Graph") + .AddGraphHealthWithILogger("Graph") .Services .BuildServiceProvider() .GetRequiredService>() @@ -284,7 +280,7 @@ public void AddGraphHealthWithILoggerFactoryCustomHealthName() new ServiceCollection() .AddLogging() .AddHealthChecks() - .AddGraphHealthWithILoggerFactory(healthName: "Graph") + .AddGraphHealthWithILoggerFactory("Graph") .Services .BuildServiceProvider() .GetRequiredService>() @@ -298,4 +294,4 @@ public void AddGraphHealthWithILoggerFactoryCustomHealthName() .Count() ); } -} \ No newline at end of file +} diff --git a/GraphHealthChecks.Tests/GraphQLHealthCheckTests.cs b/GraphHealthChecks.Tests/GraphQLHealthCheckTests.cs index 9001246..89ca40c 100644 --- a/GraphHealthChecks.Tests/GraphQLHealthCheckTests.cs +++ b/GraphHealthChecks.Tests/GraphQLHealthCheckTests.cs @@ -1,27 +1,25 @@ -using System.Threading; -using System.Net; -using HotChocolate.Authorization; +using HotChocolate.Authorization; using HotChocolate.Execution; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Diagnostics.HealthChecks; using Microsoft.Extensions.Logging; -using Moq.Contrib.HttpClient; -using HotChocolate.Utilities.Introspection; +using Snapshooter.Xunit; namespace GraphHealthChecks.Tests; public class GraphQLHealthCheckTests { - public class Query - { - public string Name => "Hello"; - } - - public class QueryAuth - { - [Authorize] - public string Name => "Hello"; - } + private static object GetErrorResult(HealthCheckResult result) => + new + { + result.Status, + result.Description, + result.Data, + Exception = new + { + result.Exception?.Message + } + }; [Fact(DisplayName = "GraphQLHealthCheck - No Logger - Unhealthy Schema")] public async Task NoLoggerUnhealthySchema() @@ -36,6 +34,8 @@ public async Task NoLoggerUnhealthySchema() Assert.Equal(HealthStatus.Unhealthy, result.Status); Assert.IsAssignableFrom(result.Exception); + + GetErrorResult(result).MatchSnapshot(); } [Fact(DisplayName = "GraphQLHealthCheck - No Logger - General Error")] @@ -50,23 +50,27 @@ public async Task NoLoggerGeneralError() Assert.Equal(HealthStatus.Unhealthy, result.Status); Assert.IsAssignableFrom(result.Exception); + + GetErrorResult(result).MatchSnapshot(); } [Fact(DisplayName = "GraphQLHealthCheck - No Logger - Healthy")] public async Task NoLoggerHealthy() { var result = await new GraphHealthCheck( - new ServiceCollection() - .AddGraphQLServer() - .AddQueryType() - .Services - .BuildServiceProvider() - .GetRequiredService() - ) - .CheckHealthAsync(null!); + new ServiceCollection() + .AddGraphQLServer() + .AddQueryType() + .Services + .BuildServiceProvider() + .GetRequiredService() + ) + .CheckHealthAsync(null!); Assert.Equal(HealthStatus.Healthy, result.Status); Assert.Null(result.Description); + + result.MatchSnapshot(); } [Fact(DisplayName = "GraphQLHealthCheck - ILogger - General Error")] @@ -79,10 +83,10 @@ public async Task ILoggerGeneralError() .ThrowsAsync(new Exception("Splash!")); var result = await new GraphHealthCheck( - mockResolver.Object, - mockLogger.Object - ) - .CheckHealthAsync(null!); + mockResolver.Object, + mockLogger.Object + ) + .CheckHealthAsync(null!); Assert.Equal(HealthStatus.Unhealthy, result.Status); Assert.IsAssignableFrom(result.Exception); @@ -90,6 +94,8 @@ public async Task ILoggerGeneralError() Assert.Contains("general", result.Description); mockLogger.VerifyLog(m => m.LogError(It.IsAny(), It.IsAny(), It.IsAny()), Times.Once); + + GetErrorResult(result).MatchSnapshot(); } [Fact(DisplayName = "GraphQLHealthCheck - ILogger - Unhealthy Schema")] @@ -98,15 +104,15 @@ public async Task ILoggerUnhealthySchema() var mockLogger = new Mock>(); var result = await new GraphHealthCheck( - new ServiceCollection() - .AddGraphQLServer() - .AddQueryType() - .Services - .BuildServiceProvider() - .GetRequiredService(), - mockLogger.Object - ) - .CheckHealthAsync(null!); + new ServiceCollection() + .AddGraphQLServer() + .AddQueryType() + .Services + .BuildServiceProvider() + .GetRequiredService(), + mockLogger.Object + ) + .CheckHealthAsync(null!); Assert.Equal(HealthStatus.Unhealthy, result.Status); Assert.IsAssignableFrom(result.Exception); @@ -114,90 +120,8 @@ public async Task ILoggerUnhealthySchema() Assert.Contains("schema", result.Description); mockLogger.VerifyLog(m => m.LogError(It.IsAny(), It.IsAny(), It.IsAny()), Times.Once); - } - [Fact(DisplayName = "GraphQLHealthCheck - ILogger - Unhealthy Stitched Schema - No Registered Http Client")] - public async Task ILoggerUnhealthyStitchedSchemaNoRegisteredHttpClient() - { - var mockLogger = new Mock>(); - - var result = await new GraphHealthCheck( - new ServiceCollection() - .AddGraphQLServer() - .AddRemoteSchema("Remote") - .Services - .BuildServiceProvider() - .GetRequiredService(), - mockLogger.Object - ) - .CheckHealthAsync(null!); - - Assert.Equal(HealthStatus.Unhealthy, result.Status); - Assert.IsAssignableFrom(result.Exception); - Assert.NotNull(result.Description); - Assert.Contains("general", result.Description); - - mockLogger.VerifyLog(m => m.LogError(It.IsAny(), It.IsAny(), It.IsAny()), Times.Once); - } - - [Fact(DisplayName = "GraphQLHealthCheck - ILogger - Unhealthy Stitched Schema - No Registered Http Client For Schema")] - public async Task ILoggerUnhealthyStitchedSchemaNoRegisteredHttpClientForSchema() - { - var mockLogger = new Mock>(); - - var result = await new GraphHealthCheck( - new ServiceCollection() - .AddSingleton(new Mock().Object) - .AddGraphQLServer() - .AddRemoteSchema("Remote") - .Services - .BuildServiceProvider() - .GetRequiredService(), - mockLogger.Object - ) - .CheckHealthAsync(null!); - - Assert.Equal(HealthStatus.Unhealthy, result.Status); - Assert.IsAssignableFrom(result.Exception); - Assert.NotNull(result.Description); - Assert.Contains("general", result.Description); - - mockLogger.VerifyLog(m => m.LogError(It.IsAny(), It.IsAny(), It.IsAny()), Times.Once); - } - - [Fact(DisplayName = "GraphQLHealthCheck - ILogger - Unhealthy Stitched Schema - Http Client Returns Error For Schema")] - public async Task ILoggerUnhealthyStitchedSchemaHttpClientReturnsErrorForSchema() - { - var mockLogger = new Mock>(); - var handler = new Mock(MockBehavior.Strict); - handler - .SetupAnyRequest() - .ReturnsResponse(HttpStatusCode.InternalServerError); - var httpClient = handler.CreateClient(); - httpClient.BaseAddress = new Uri("http://localhost/graphql"); - var mockHttpFactory = new Mock(); - mockHttpFactory - .Setup(m => m.CreateClient("Remote")) - .Returns(httpClient); - - var result = await new GraphHealthCheck( - new ServiceCollection() - .AddSingleton(mockHttpFactory.Object) - .AddGraphQLServer() - .AddRemoteSchema("Remote") - .Services - .BuildServiceProvider() - .GetRequiredService(), - mockLogger.Object - ) - .CheckHealthAsync(null!); - - Assert.Equal(HealthStatus.Unhealthy, result.Status); - Assert.IsAssignableFrom(result.Exception); - Assert.NotNull(result.Description); - Assert.Contains("general", result.Description); - - mockLogger.VerifyLog(m => m.LogError(It.IsAny(), It.IsAny(), It.IsAny()), Times.Once); + GetErrorResult(result).MatchSnapshot(); } [Fact(DisplayName = "GraphQLHealthCheck - ILogger - Unhealthy Schema - No Auth")] @@ -206,15 +130,15 @@ public async Task ILoggerUnhealthySchemaNoAuth() var mockLogger = new Mock>(); var result = await new GraphHealthCheck( - new ServiceCollection() - .AddGraphQLServer() - .AddQueryType() - .Services - .BuildServiceProvider() - .GetRequiredService(), - mockLogger.Object - ) - .CheckHealthAsync(null!); + new ServiceCollection() + .AddGraphQLServer() + .AddQueryType() + .Services + .BuildServiceProvider() + .GetRequiredService(), + mockLogger.Object + ) + .CheckHealthAsync(null!); Assert.Equal(HealthStatus.Unhealthy, result.Status); Assert.IsAssignableFrom(result.Exception); @@ -222,6 +146,8 @@ public async Task ILoggerUnhealthySchemaNoAuth() Assert.Contains("schema", result.Description); mockLogger.VerifyLog(m => m.LogError(It.IsAny(), It.IsAny(), It.IsAny()), Times.Once); + + GetErrorResult(result).MatchSnapshot(); } [Fact(DisplayName = "GraphQLHealthCheck - ILogger - Unhealthy Schema - No Auth - General Error")] @@ -240,6 +166,8 @@ public async Task ILoggerUnhealthySchemaNoAuthGeneralError() Assert.IsAssignableFrom(result.Exception); mockLogger.VerifyLog(m => m.LogError(It.IsAny(), It.IsAny(), It.IsAny()), Times.Once); + + GetErrorResult(result).MatchSnapshot(); } [Fact(DisplayName = "GraphQLHealthCheck - ILogger - Healthy - Auth")] @@ -248,21 +176,23 @@ public async Task ILoggerHealthyAuth() var mockLogger = new Mock>(); var result = await new GraphHealthCheck( - new ServiceCollection() - .AddGraphQLServer() - .AddAuthorization() - .AddQueryType() - .Services - .BuildServiceProvider() - .GetRequiredService(), - mockLogger.Object - ) - .CheckHealthAsync(null!); + new ServiceCollection() + .AddGraphQLServer() + .AddAuthorization() + .AddQueryType() + .Services + .BuildServiceProvider() + .GetRequiredService(), + mockLogger.Object + ) + .CheckHealthAsync(null!); Assert.Equal(HealthStatus.Healthy, result.Status); Assert.Null(result.Description); mockLogger.VerifyLog(m => m.LogError(It.IsAny(), It.IsAny(), It.IsAny()), Times.Never); + + result.MatchSnapshot(); } [Fact(DisplayName = "GraphQLHealthCheck - ILogger - Healthy")] @@ -271,19 +201,32 @@ public async Task ILoggerHealthy() var mockLogger = new Mock>(); var result = await new GraphHealthCheck( - new ServiceCollection() - .AddGraphQLServer() - .AddQueryType() - .Services - .BuildServiceProvider() - .GetRequiredService(), - mockLogger.Object - ) - .CheckHealthAsync(null!); + new ServiceCollection() + .AddGraphQLServer() + .AddQueryType() + .Services + .BuildServiceProvider() + .GetRequiredService(), + mockLogger.Object + ) + .CheckHealthAsync(null!); Assert.Equal(HealthStatus.Healthy, result.Status); Assert.Null(result.Description); mockLogger.VerifyLog(m => m.LogError(It.IsAny(), It.IsAny(), It.IsAny()), Times.Never); + + result.MatchSnapshot(); + } + + public class Query + { + public string Name => "Hello"; + } + + public class QueryAuth + { + [Authorize] + public string Name => "Hello"; } } diff --git a/GraphHealthChecks.Tests/__snapshots__/GraphQLHealthCheckTests.ILoggerGeneralError.snap b/GraphHealthChecks.Tests/__snapshots__/GraphQLHealthCheckTests.ILoggerGeneralError.snap new file mode 100644 index 0000000..69599f9 --- /dev/null +++ b/GraphHealthChecks.Tests/__snapshots__/GraphQLHealthCheckTests.ILoggerGeneralError.snap @@ -0,0 +1,8 @@ +{ + "Status": "Unhealthy", + "Description": "A general error has occurred.", + "Data": {}, + "Exception": { + "Message": "Splash!" + } +} diff --git a/GraphHealthChecks.Tests/__snapshots__/GraphQLHealthCheckTests.ILoggerHealthy.snap b/GraphHealthChecks.Tests/__snapshots__/GraphQLHealthCheckTests.ILoggerHealthy.snap new file mode 100644 index 0000000..5582491 --- /dev/null +++ b/GraphHealthChecks.Tests/__snapshots__/GraphQLHealthCheckTests.ILoggerHealthy.snap @@ -0,0 +1,6 @@ +{ + "Data": {}, + "Description": null, + "Exception": null, + "Status": "Healthy" +} diff --git a/GraphHealthChecks.Tests/__snapshots__/GraphQLHealthCheckTests.ILoggerHealthyAuth.snap b/GraphHealthChecks.Tests/__snapshots__/GraphQLHealthCheckTests.ILoggerHealthyAuth.snap new file mode 100644 index 0000000..5582491 --- /dev/null +++ b/GraphHealthChecks.Tests/__snapshots__/GraphQLHealthCheckTests.ILoggerHealthyAuth.snap @@ -0,0 +1,6 @@ +{ + "Data": {}, + "Description": null, + "Exception": null, + "Status": "Healthy" +} diff --git a/GraphHealthChecks.Tests/__snapshots__/GraphQLHealthCheckTests.ILoggerUnhealthySchema.snap b/GraphHealthChecks.Tests/__snapshots__/GraphQLHealthCheckTests.ILoggerUnhealthySchema.snap new file mode 100644 index 0000000..73be230 --- /dev/null +++ b/GraphHealthChecks.Tests/__snapshots__/GraphQLHealthCheckTests.ILoggerUnhealthySchema.snap @@ -0,0 +1,8 @@ +{ + "Status": "Unhealthy", + "Description": "The schema cannot be resolved.", + "Data": {}, + "Exception": { + "Message": "For more details look at the `Errors` property.\n\n1. The object type `Query` has to at least define one field in order to be valid. (HotChocolate.Types.ObjectType)\n" + } +} diff --git a/GraphHealthChecks.Tests/__snapshots__/GraphQLHealthCheckTests.ILoggerUnhealthySchemaNoAuth.snap b/GraphHealthChecks.Tests/__snapshots__/GraphQLHealthCheckTests.ILoggerUnhealthySchemaNoAuth.snap new file mode 100644 index 0000000..1428fcf --- /dev/null +++ b/GraphHealthChecks.Tests/__snapshots__/GraphQLHealthCheckTests.ILoggerUnhealthySchemaNoAuth.snap @@ -0,0 +1,8 @@ +{ + "Status": "Unhealthy", + "Description": "The schema cannot be resolved.", + "Data": {}, + "Exception": { + "Message": "For more details look at the `Errors` property.\n\n1. Unable to infer or resolve a schema type from the type reference `@AuthorizeDirective`. (HotChocolate.Types.ObjectType)\n" + } +} diff --git a/GraphHealthChecks.Tests/__snapshots__/GraphQLHealthCheckTests.ILoggerUnhealthySchemaNoAuthGeneralError.snap b/GraphHealthChecks.Tests/__snapshots__/GraphQLHealthCheckTests.ILoggerUnhealthySchemaNoAuthGeneralError.snap new file mode 100644 index 0000000..69599f9 --- /dev/null +++ b/GraphHealthChecks.Tests/__snapshots__/GraphQLHealthCheckTests.ILoggerUnhealthySchemaNoAuthGeneralError.snap @@ -0,0 +1,8 @@ +{ + "Status": "Unhealthy", + "Description": "A general error has occurred.", + "Data": {}, + "Exception": { + "Message": "Splash!" + } +} diff --git a/GraphHealthChecks.Tests/__snapshots__/GraphQLHealthCheckTests.NoLoggerGeneralError.snap b/GraphHealthChecks.Tests/__snapshots__/GraphQLHealthCheckTests.NoLoggerGeneralError.snap new file mode 100644 index 0000000..69599f9 --- /dev/null +++ b/GraphHealthChecks.Tests/__snapshots__/GraphQLHealthCheckTests.NoLoggerGeneralError.snap @@ -0,0 +1,8 @@ +{ + "Status": "Unhealthy", + "Description": "A general error has occurred.", + "Data": {}, + "Exception": { + "Message": "Splash!" + } +} diff --git a/GraphHealthChecks.Tests/__snapshots__/GraphQLHealthCheckTests.NoLoggerHealthy.snap b/GraphHealthChecks.Tests/__snapshots__/GraphQLHealthCheckTests.NoLoggerHealthy.snap new file mode 100644 index 0000000..5582491 --- /dev/null +++ b/GraphHealthChecks.Tests/__snapshots__/GraphQLHealthCheckTests.NoLoggerHealthy.snap @@ -0,0 +1,6 @@ +{ + "Data": {}, + "Description": null, + "Exception": null, + "Status": "Healthy" +} diff --git a/GraphHealthChecks.Tests/__snapshots__/GraphQLHealthCheckTests.NoLoggerUnhealthySchema.snap b/GraphHealthChecks.Tests/__snapshots__/GraphQLHealthCheckTests.NoLoggerUnhealthySchema.snap new file mode 100644 index 0000000..8d31973 --- /dev/null +++ b/GraphHealthChecks.Tests/__snapshots__/GraphQLHealthCheckTests.NoLoggerUnhealthySchema.snap @@ -0,0 +1,8 @@ +{ + "Status": "Unhealthy", + "Description": "The schema cannot be resolved.", + "Data": {}, + "Exception": { + "Message": "Unexpected schema exception occurred." + } +} diff --git a/GraphHealthChecks.sln b/GraphHealthChecks.sln index f609163..dd19959 100644 --- a/GraphHealthChecks.sln +++ b/GraphHealthChecks.sln @@ -11,6 +11,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution ProjectSection(SolutionItems) = preProject README.md = README.md NOTES.md = NOTES.md + .gitignore = .gitignore + global.json = global.json + LICENSE = LICENSE + .editorconfig = .editorconfig EndProjectSection EndProject Global diff --git a/GraphHealthChecks/GraphHealthCheck.cs b/GraphHealthChecks/GraphHealthCheck.cs index 64e3934..1507633 100644 --- a/GraphHealthChecks/GraphHealthCheck.cs +++ b/GraphHealthChecks/GraphHealthCheck.cs @@ -1,29 +1,25 @@ -using System; -using System.Threading; -using System.Threading.Tasks; -using HotChocolate; -using HotChocolate.Execution; -using Microsoft.Extensions.Diagnostics.HealthChecks; -using Microsoft.Extensions.Logging; - -namespace GraphHealthChecks; +namespace GraphHealthChecks; public record GraphHealthCheck : IHealthCheck { - public string? Schema { get; set; } - - private readonly IRequestExecutorResolver _requestExecutorResolver; - private readonly ILogger? _logger; - private const string _message = $"[{nameof(GraphHealthChecks)}] An error has occurred with message: {{message}}"; private const string _generalSchemaError = "The schema cannot be resolved."; private const string _generalError = "A general error has occurred."; + private readonly ILogger? _logger; - public GraphHealthCheck(IRequestExecutorResolver requestExecutorResolver, ILogger logger) => + private readonly IRequestExecutorResolver _requestExecutorResolver; + + public GraphHealthCheck(IRequestExecutorResolver requestExecutorResolver, ILogger logger) + { (_requestExecutorResolver, _logger) = (requestExecutorResolver, logger); + } - public GraphHealthCheck(IRequestExecutorResolver requestExecutorResolver) => + public GraphHealthCheck(IRequestExecutorResolver requestExecutorResolver) + { _requestExecutorResolver = requestExecutorResolver; + } + + public string? Schema { get; set; } public async Task CheckHealthAsync(HealthCheckContext context, CancellationToken cancellationToken = default) { @@ -31,8 +27,8 @@ public async Task CheckHealthAsync(HealthCheckContext context { _ = ( await _requestExecutorResolver.GetRequestExecutorAsync( - schemaName: Schema, - cancellationToken: cancellationToken + Schema, + cancellationToken ) ).Schema.ToDocument(); diff --git a/GraphHealthChecks/GraphHealthChecks.csproj b/GraphHealthChecks/GraphHealthChecks.csproj index b3d7ef5..32aa04e 100644 --- a/GraphHealthChecks/GraphHealthChecks.csproj +++ b/GraphHealthChecks/GraphHealthChecks.csproj @@ -1,22 +1,30 @@ - - - net6.0;net8.0 - enable - true - true - $(MSBuildProjectName) - 2.0.1 - Adamos Fiakkas - Graph Health Checks for HotChocolate - Adamos Fiakkas - MIT - https://github.com/fiakkasa/GraphHealthChecks - https://github.com/fiakkasa/GraphHealthChecks - git - - - - - + + net8.0 + enable + true + true + $(MSBuildProjectName) + 3.0.0-beta.1 + Adamos Fiakkas + Graph Health Checks for HotChocolate + Adamos Fiakkas + MIT + https://github.com/fiakkasa/GraphHealthChecks + https://github.com/fiakkasa/GraphHealthChecks + git + + + + + + + + + + + + + + \ No newline at end of file diff --git a/GraphHealthChecks/GraphHealthChecksFactories.cs b/GraphHealthChecks/GraphHealthChecksFactories.cs index e9cc54c..1138002 100644 --- a/GraphHealthChecks/GraphHealthChecksFactories.cs +++ b/GraphHealthChecks/GraphHealthChecksFactories.cs @@ -1,20 +1,14 @@ -using System; -using HotChocolate.Execution; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Diagnostics.HealthChecks; -using Microsoft.Extensions.Logging; - -namespace GraphHealthChecks; +namespace GraphHealthChecks; public static class GraphHealthChecksFactories { - public static Func GraphHealthCheckFactoryWithNoLogger(string? schemaName = default) => (IServiceProvider sp) => + public static Func GraphHealthCheckFactoryWithNoLogger(string? schemaName = default) => sp => new GraphHealthCheck(sp.GetRequiredService()) { Schema = schemaName }; - public static Func GraphHealthCheckFactoryWithILogger(string? schemaName = default) => (IServiceProvider sp) => + public static Func GraphHealthCheckFactoryWithILogger(string? schemaName = default) => sp => new GraphHealthCheck( sp.GetRequiredService(), sp.GetRequiredService>() @@ -23,7 +17,7 @@ public static Func GraphHealthCheckFactoryWithIL Schema = schemaName }; - public static Func GraphHealthCheckFactoryWithILoggerFactory(string? schemaName = default) => (IServiceProvider sp) => + public static Func GraphHealthCheckFactoryWithILoggerFactory(string? schemaName = default) => sp => new GraphHealthCheck( sp.GetRequiredService(), sp.GetRequiredService().CreateLogger() diff --git a/GraphHealthChecks/GraphHealthExtensions.cs b/GraphHealthChecks/GraphHealthExtensions.cs index 9f19a00..670916a 100644 --- a/GraphHealthChecks/GraphHealthExtensions.cs +++ b/GraphHealthChecks/GraphHealthExtensions.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Diagnostics.HealthChecks; - -namespace GraphHealthChecks; +namespace GraphHealthChecks; public static class GraphHealthExtensions { @@ -46,7 +41,7 @@ public static IHealthChecksBuilder AddGraphHealthWithILogger( ); public static IHealthChecksBuilder AddGraphHealthWithILoggerFactory( - this IHealthChecksBuilder builder, + this IHealthChecksBuilder builder, string healthName = _defaultHealthName, string? schemaName = default, HealthStatus? failureStatus = default, @@ -62,4 +57,4 @@ public static IHealthChecksBuilder AddGraphHealthWithILoggerFactory( timeout ) ); -} \ No newline at end of file +} diff --git a/GraphHealthChecks/README.md b/GraphHealthChecks/README.md new file mode 100644 index 0000000..a6c6a0f --- /dev/null +++ b/GraphHealthChecks/README.md @@ -0,0 +1,80 @@ +# GraphHealthChecks + +Graph Health Checks for HotChocolate. + +The purpose of this middleware is to provide feedback in regards to the health of the schema. + +[Nuget](https://www.nuget.org/packages/GraphHealthChecks/) + +## Compatibility + +### Current Releases + +| HotChocolate Version | DataAnnotatedModelValidations Version | .NET Version | +|-----------------------|---------------------------------------|--------------| +| 14.0.0-rc.0 or higher | 3.0.0-beta.1 | .NET 8 | + +### Past Releases + +| HotChocolate Version | Last DataAnnotatedModelValidations Version | .NET Version | +|----------------------|--------------------------------------------|--------------| +| 13.7.0 or higher | 2.0.1 | .NET 6, 8 | +| 13.3.3 or higher | 1.0.2 | .NET 6 | + +📝For more information please visit https://www.nuget.org/packages/GraphHealthChecks/#versions-body-tab + +## Note + +There appears to be a compatibility issue for projects targeting .NET 7 and assembly +`Assembly Microsoft.Extensions.Hosting, Version=7.0.0.0` and more specifically +`OptionsBuilderExtensions.ValidateOnStart` resulting in error: + +> The call is ambiguous between the following methods or properties: +> `Microsoft.Extensions.DependencyInjection.OptionsBuilderExtensions.ValidateOnStart(Microsoft.Extensions.Options.OptionsBuilder)` +> and `Microsoft.Extensions.DependencyInjection.OptionsBuilderExtensions.ValidateOnStart(Microsoft.Extensions.Options.OptionsBuilder)` + +Until resolved please consider using a version of the package targeting .NET 7. + +## Usage + +Locate the services registration and append one of: + +- `.AddGraphHealthWithNoLogger` - use when no logging is required +- `.AddGraphHealthWithILogger` - use when the ILogger provider is available +- `.AddGraphHealthWithILoggerFactory` - use when the ILoggerFactory provider is available + +⚠️ Bear in mind that `IHealthChecksBuilder` needs to be appended before any of the aforementioned. + +ex. + +```csharp +// Startup.cs +public void ConfigureServices(IServiceCollection services) +{ + // ... + services + .AddHealthChecks() + .AddGraphHealthWithILogger(); + // ... +} +``` + +📝 If further customization is required, consider wiring up any of the factories manually or use the `GraphHealthCheck` +class itself as required. + +If separate schemas are present, multiple registrations can be done for each schema. + +ex. + +```csharp +// Startup.cs +public void ConfigureServices(IServiceCollection services) +{ + // ... + services + .AddHealthChecks() + .AddGraphHealthWithILogger(healthName: "health1", schemaName: "schema1") + .AddGraphHealthWithILogger(healthName: "health2", schemaName: "schema2"); + // ... +} +``` diff --git a/GraphHealthChecks/Usings.cs b/GraphHealthChecks/Usings.cs new file mode 100644 index 0000000..5661c8a --- /dev/null +++ b/GraphHealthChecks/Usings.cs @@ -0,0 +1,10 @@ +global using HotChocolate.Execution; +global using HotChocolate; +global using Microsoft.Extensions.DependencyInjection; +global using Microsoft.Extensions.Diagnostics.HealthChecks; +global using Microsoft.Extensions.Logging; +global using System.Collections.Generic; +global using System.Threading.Tasks; +global using System.Threading; +global using System; +global using System; diff --git a/NOTES.md b/NOTES.md index ec1aeb5..464f336 100644 --- a/NOTES.md +++ b/NOTES.md @@ -7,14 +7,15 @@ ## Tests -- Run: `dotnet test /p:CollectCoverage=true /p:Threshold=80 /p:CoverletOutputFormat=cobertura /p:CoverletOutput='./coverage.cobertura.xml'` -- Report: `dotnet reportgenerator -reports:./coverage.cobertura.net8.0.xml -targetdir:./TestResults -reporttypes:Html` +- Run: + `dotnet test /p:CollectCoverage=true /p:Threshold=80 /p:CoverletOutputFormat=cobertura /p:CoverletOutput='../coverage.cobertura.xml'` +- Report: `dotnet reportgenerator -reports:./coverage.cobertura.xml -targetdir:./TestResults -reporttypes:Html` In one Go! ```powershell -dotnet test /p:CollectCoverage=true /p:Threshold=80 /p:CoverletOutputFormat=cobertura /p:CoverletOutput='./coverage.cobertura.xml' -dotnet reportgenerator -reports:./coverage.cobertura.net8.0.xml -targetdir:./TestResults -reporttypes:Html +dotnet test /p:CollectCoverage=true /p:Threshold=80 /p:CoverletOutputFormat=cobertura /p:CoverletOutput='../coverage.cobertura.xml' +dotnet reportgenerator -reports:./coverage.cobertura.xml -targetdir:./TestResults -reporttypes:Html ``` ## Info diff --git a/README.md b/README.md index 0546030..aab35ff 100644 --- a/README.md +++ b/README.md @@ -10,13 +10,34 @@ The purpose of this middleware is to provide feedback in regards to the health o [Nuget](https://www.nuget.org/packages/GraphHealthChecks/) +## Compatibility + +### Current Releases + +| HotChocolate Version | DataAnnotatedModelValidations Version | .NET Version | +|-----------------------|---------------------------------------|--------------| +| 14.0.0-rc.0 or higher | 3.0.0-beta.1 | .NET 8 | + +### Past Releases + +| HotChocolate Version | Last DataAnnotatedModelValidations Version | .NET Version | +|----------------------|--------------------------------------------|--------------| +| 13.7.0 or higher | 2.0.1 | .NET 6, 8 | +| 13.3.3 or higher | 1.0.2 | .NET 6, 7 | + +📝For more information please visit https://www.nuget.org/packages/GraphHealthChecks/#versions-body-tab + ## Note -There appears to be a compatibility issue for projects targeting .NET 7 and assembly `Assembly Microsoft.Extensions.Hosting, Version=7.0.0.0` and more specifically `OptionsBuilderExtensions.ValidateOnStart` resulting in error: +There appears to be a compatibility issue for projects targeting .NET 7 and assembly +`Assembly Microsoft.Extensions.Hosting, Version=7.0.0.0` and more specifically +`OptionsBuilderExtensions.ValidateOnStart` resulting in error: -> The call is ambiguous between the following methods or properties: 'Microsoft.Extensions.DependencyInjection.OptionsBuilderExtensions.ValidateOnStart(Microsoft.Extensions.Options.OptionsBuilder)' and 'Microsoft.Extensions.DependencyInjection.OptionsBuilderExtensions.ValidateOnStart(Microsoft.Extensions.Options.OptionsBuilder)' +> The call is ambiguous between the following methods or properties: +> `Microsoft.Extensions.DependencyInjection.OptionsBuilderExtensions.ValidateOnStart(Microsoft.Extensions.Options.OptionsBuilder)` +> and `Microsoft.Extensions.DependencyInjection.OptionsBuilderExtensions.ValidateOnStart(Microsoft.Extensions.Options.OptionsBuilder)` -Until resolved please consider using a previous version of the package targeting .NET 7. +Until resolved please consider using a version of the package targeting .NET 7. ## Usage @@ -42,7 +63,8 @@ public void ConfigureServices(IServiceCollection services) } ``` -📝 If further customization is required, consider wiring up any of the factories manually or use the `GraphHealthCheck` class itself as required. +📝 If further customization is required, consider wiring up any of the factories manually or use the `GraphHealthCheck` +class itself as required. If separate schemas are present, multiple registrations can be done for each schema. diff --git a/global.json b/global.json new file mode 100644 index 0000000..e972eb1 --- /dev/null +++ b/global.json @@ -0,0 +1,6 @@ +{ + "sdk": { + "version": "8.0.300", + "rollForward": "latestFeature" + } +} From 782462d4e030a9d9b3436b51116b036006d0697b Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 4 Sep 2024 17:12:27 +0300 Subject: [PATCH 2/8] Docs --- GraphHealthChecks/README.md | 5 +++-- README.md | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/GraphHealthChecks/README.md b/GraphHealthChecks/README.md index a6c6a0f..fd707db 100644 --- a/GraphHealthChecks/README.md +++ b/GraphHealthChecks/README.md @@ -30,8 +30,9 @@ There appears to be a compatibility issue for projects targeting .NET 7 and asse `OptionsBuilderExtensions.ValidateOnStart` resulting in error: > The call is ambiguous between the following methods or properties: -> `Microsoft.Extensions.DependencyInjection.OptionsBuilderExtensions.ValidateOnStart(Microsoft.Extensions.Options.OptionsBuilder)` -> and `Microsoft.Extensions.DependencyInjection.OptionsBuilderExtensions.ValidateOnStart(Microsoft.Extensions.Options.OptionsBuilder)` +> ```csharp +> Microsoft.Extensions.DependencyInjection.OptionsBuilderExtensions.ValidateOnStart(Microsoft.Extensions.Options.OptionsBuilder) +> ``` Until resolved please consider using a version of the package targeting .NET 7. diff --git a/README.md b/README.md index aab35ff..4bb8e5f 100644 --- a/README.md +++ b/README.md @@ -34,8 +34,9 @@ There appears to be a compatibility issue for projects targeting .NET 7 and asse `OptionsBuilderExtensions.ValidateOnStart` resulting in error: > The call is ambiguous between the following methods or properties: -> `Microsoft.Extensions.DependencyInjection.OptionsBuilderExtensions.ValidateOnStart(Microsoft.Extensions.Options.OptionsBuilder)` -> and `Microsoft.Extensions.DependencyInjection.OptionsBuilderExtensions.ValidateOnStart(Microsoft.Extensions.Options.OptionsBuilder)` +> ```csharp +> Microsoft.Extensions.DependencyInjection.OptionsBuilderExtensions.ValidateOnStart(Microsoft.Extensions.Options.OptionsBuilder) +> ``` Until resolved please consider using a version of the package targeting .NET 7. From e1fc6bc00b637f3d131a0b2ee58cf9a2191153bd Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 6 Sep 2024 13:46:42 +0300 Subject: [PATCH 3/8] Updates --- GraphHealthChecks.Tests/GraphHealthChecks.Tests.csproj | 6 +++--- GraphHealthChecks/GraphHealthChecks.csproj | 3 ++- GraphHealthChecks/README.md | 8 ++++---- GraphHealthChecks/Usings.cs | 1 - README.md | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/GraphHealthChecks.Tests/GraphHealthChecks.Tests.csproj b/GraphHealthChecks.Tests/GraphHealthChecks.Tests.csproj index 2592d16..20330ae 100644 --- a/GraphHealthChecks.Tests/GraphHealthChecks.Tests.csproj +++ b/GraphHealthChecks.Tests/GraphHealthChecks.Tests.csproj @@ -9,11 +9,11 @@ - - + + - + diff --git a/GraphHealthChecks/GraphHealthChecks.csproj b/GraphHealthChecks/GraphHealthChecks.csproj index 32aa04e..e02ae68 100644 --- a/GraphHealthChecks/GraphHealthChecks.csproj +++ b/GraphHealthChecks/GraphHealthChecks.csproj @@ -13,6 +13,7 @@ https://github.com/fiakkasa/GraphHealthChecks https://github.com/fiakkasa/GraphHealthChecks git + README.md @@ -21,7 +22,7 @@ - + diff --git a/GraphHealthChecks/README.md b/GraphHealthChecks/README.md index fd707db..87a34f1 100644 --- a/GraphHealthChecks/README.md +++ b/GraphHealthChecks/README.md @@ -2,7 +2,7 @@ Graph Health Checks for HotChocolate. -The purpose of this middleware is to provide feedback in regards to the health of the schema. +The purpose of this middleware is to provide feedback regarding the health of the schema. [Nuget](https://www.nuget.org/packages/GraphHealthChecks/) @@ -12,14 +12,14 @@ The purpose of this middleware is to provide feedback in regards to the health o | HotChocolate Version | DataAnnotatedModelValidations Version | .NET Version | |-----------------------|---------------------------------------|--------------| -| 14.0.0-rc.0 or higher | 3.0.0-beta.1 | .NET 8 | +| 14.0.0-rc.1 or higher | 3.0.0-beta.1 | .NET 8 | ### Past Releases | HotChocolate Version | Last DataAnnotatedModelValidations Version | .NET Version | |----------------------|--------------------------------------------|--------------| | 13.7.0 or higher | 2.0.1 | .NET 6, 8 | -| 13.3.3 or higher | 1.0.2 | .NET 6 | +| 13.3.3 or higher | 1.0.2 | .NET 6, 7 | 📝For more information please visit https://www.nuget.org/packages/GraphHealthChecks/#versions-body-tab @@ -78,4 +78,4 @@ public void ConfigureServices(IServiceCollection services) .AddGraphHealthWithILogger(healthName: "health2", schemaName: "schema2"); // ... } -``` +``` \ No newline at end of file diff --git a/GraphHealthChecks/Usings.cs b/GraphHealthChecks/Usings.cs index 5661c8a..b8fd346 100644 --- a/GraphHealthChecks/Usings.cs +++ b/GraphHealthChecks/Usings.cs @@ -7,4 +7,3 @@ global using System.Threading.Tasks; global using System.Threading; global using System; -global using System; diff --git a/README.md b/README.md index 4bb8e5f..bfc0b64 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Graph Health Checks for HotChocolate. -The purpose of this middleware is to provide feedback in regards to the health of the schema. +The purpose of this middleware is to provide feedback regarding the health of the schema. [Nuget](https://www.nuget.org/packages/GraphHealthChecks/) @@ -16,7 +16,7 @@ The purpose of this middleware is to provide feedback in regards to the health o | HotChocolate Version | DataAnnotatedModelValidations Version | .NET Version | |-----------------------|---------------------------------------|--------------| -| 14.0.0-rc.0 or higher | 3.0.0-beta.1 | .NET 8 | +| 14.0.0-rc.1 or higher | 3.0.0-beta.1 | .NET 8 | ### Past Releases From 5eb5d405de49c18fa0c50d44e39984e8e533bb22 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 12 Sep 2024 14:45:24 +0300 Subject: [PATCH 4/8] Update Runtime --- global.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global.json b/global.json index e972eb1..ae9f38c 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "8.0.300", + "version": "8.0.400", "rollForward": "latestFeature" } } From 2e154ac41f98807b40731cb8fd831e61eb4bbba6 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 22 Sep 2024 15:44:44 +0300 Subject: [PATCH 5/8] Update packages --- GraphHealthChecks.Tests/GraphHealthChecks.Tests.csproj | 4 ++-- GraphHealthChecks/GraphHealthChecks.csproj | 2 +- GraphHealthChecks/README.md | 2 +- README.md | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/GraphHealthChecks.Tests/GraphHealthChecks.Tests.csproj b/GraphHealthChecks.Tests/GraphHealthChecks.Tests.csproj index 20330ae..6a8ef7b 100644 --- a/GraphHealthChecks.Tests/GraphHealthChecks.Tests.csproj +++ b/GraphHealthChecks.Tests/GraphHealthChecks.Tests.csproj @@ -9,8 +9,8 @@ - - + + diff --git a/GraphHealthChecks/GraphHealthChecks.csproj b/GraphHealthChecks/GraphHealthChecks.csproj index e02ae68..e5ee4fb 100644 --- a/GraphHealthChecks/GraphHealthChecks.csproj +++ b/GraphHealthChecks/GraphHealthChecks.csproj @@ -22,7 +22,7 @@ - + diff --git a/GraphHealthChecks/README.md b/GraphHealthChecks/README.md index 87a34f1..2fd85cf 100644 --- a/GraphHealthChecks/README.md +++ b/GraphHealthChecks/README.md @@ -12,7 +12,7 @@ The purpose of this middleware is to provide feedback regarding the health of th | HotChocolate Version | DataAnnotatedModelValidations Version | .NET Version | |-----------------------|---------------------------------------|--------------| -| 14.0.0-rc.1 or higher | 3.0.0-beta.1 | .NET 8 | +| 14.0.0-rc.2 or higher | 3.0.0-beta.1 | .NET 8 | ### Past Releases diff --git a/README.md b/README.md index bfc0b64..4e3de03 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ The purpose of this middleware is to provide feedback regarding the health of th | HotChocolate Version | DataAnnotatedModelValidations Version | .NET Version | |-----------------------|---------------------------------------|--------------| -| 14.0.0-rc.1 or higher | 3.0.0-beta.1 | .NET 8 | +| 14.0.0-rc.2 or higher | 3.0.0-beta.1 | .NET 8 | ### Past Releases From 0dd9368eb61727c56cc772c50923e756f7ced07c Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 10 Oct 2024 22:59:59 +0300 Subject: [PATCH 6/8] Update Packages --- GraphHealthChecks.Tests/GraphHealthChecks.Tests.csproj | 8 ++++---- GraphHealthChecks/GraphHealthChecks.csproj | 4 ++-- GraphHealthChecks/README.md | 2 +- README.md | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/GraphHealthChecks.Tests/GraphHealthChecks.Tests.csproj b/GraphHealthChecks.Tests/GraphHealthChecks.Tests.csproj index 6a8ef7b..97f9847 100644 --- a/GraphHealthChecks.Tests/GraphHealthChecks.Tests.csproj +++ b/GraphHealthChecks.Tests/GraphHealthChecks.Tests.csproj @@ -9,14 +9,14 @@ - - + + - + - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/GraphHealthChecks/GraphHealthChecks.csproj b/GraphHealthChecks/GraphHealthChecks.csproj index e5ee4fb..c146bbb 100644 --- a/GraphHealthChecks/GraphHealthChecks.csproj +++ b/GraphHealthChecks/GraphHealthChecks.csproj @@ -21,8 +21,8 @@ - - + + diff --git a/GraphHealthChecks/README.md b/GraphHealthChecks/README.md index 2fd85cf..caad09a 100644 --- a/GraphHealthChecks/README.md +++ b/GraphHealthChecks/README.md @@ -12,7 +12,7 @@ The purpose of this middleware is to provide feedback regarding the health of th | HotChocolate Version | DataAnnotatedModelValidations Version | .NET Version | |-----------------------|---------------------------------------|--------------| -| 14.0.0-rc.2 or higher | 3.0.0-beta.1 | .NET 8 | +| 14.0.0-rc.3 or higher | 3.0.0-beta.1 | .NET 8 | ### Past Releases diff --git a/README.md b/README.md index 4e3de03..8179720 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ The purpose of this middleware is to provide feedback regarding the health of th | HotChocolate Version | DataAnnotatedModelValidations Version | .NET Version | |-----------------------|---------------------------------------|--------------| -| 14.0.0-rc.2 or higher | 3.0.0-beta.1 | .NET 8 | +| 14.0.0-rc.3 or higher | 3.0.0-beta.1 | .NET 8 | ### Past Releases From 727a7ae4360597bf66b616a6040f4fad4baf2e24 Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 16 Oct 2024 20:28:56 +0300 Subject: [PATCH 7/8] Updates and Cleanup --- GraphHealthChecks.Tests/GraphHealthChecks.Tests.csproj | 4 ++-- GraphHealthChecks/GraphHealthChecks.csproj | 4 ++-- GraphHealthChecks/README.md | 6 +++--- README.md | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/GraphHealthChecks.Tests/GraphHealthChecks.Tests.csproj b/GraphHealthChecks.Tests/GraphHealthChecks.Tests.csproj index 97f9847..0716b7e 100644 --- a/GraphHealthChecks.Tests/GraphHealthChecks.Tests.csproj +++ b/GraphHealthChecks.Tests/GraphHealthChecks.Tests.csproj @@ -9,8 +9,8 @@ - - + + diff --git a/GraphHealthChecks/GraphHealthChecks.csproj b/GraphHealthChecks/GraphHealthChecks.csproj index c146bbb..bfdc58f 100644 --- a/GraphHealthChecks/GraphHealthChecks.csproj +++ b/GraphHealthChecks/GraphHealthChecks.csproj @@ -5,7 +5,7 @@ true true $(MSBuildProjectName) - 3.0.0-beta.1 + 3.0.0 Adamos Fiakkas Graph Health Checks for HotChocolate Adamos Fiakkas @@ -22,7 +22,7 @@ - + diff --git a/GraphHealthChecks/README.md b/GraphHealthChecks/README.md index caad09a..d7988f4 100644 --- a/GraphHealthChecks/README.md +++ b/GraphHealthChecks/README.md @@ -10,9 +10,9 @@ The purpose of this middleware is to provide feedback regarding the health of th ### Current Releases -| HotChocolate Version | DataAnnotatedModelValidations Version | .NET Version | -|-----------------------|---------------------------------------|--------------| -| 14.0.0-rc.3 or higher | 3.0.0-beta.1 | .NET 8 | +| HotChocolate Version | DataAnnotatedModelValidations Version | .NET Version | +|----------------------|---------------------------------------|--------------| +| 14.0.0 or higher | 3.0.0 | .NET 8 | ### Past Releases diff --git a/README.md b/README.md index 8179720..8497625 100644 --- a/README.md +++ b/README.md @@ -14,9 +14,9 @@ The purpose of this middleware is to provide feedback regarding the health of th ### Current Releases -| HotChocolate Version | DataAnnotatedModelValidations Version | .NET Version | -|-----------------------|---------------------------------------|--------------| -| 14.0.0-rc.3 or higher | 3.0.0-beta.1 | .NET 8 | +| HotChocolate Version | DataAnnotatedModelValidations Version | .NET Version | +|----------------------|---------------------------------------|--------------| +| 14.0.0 or higher | 3.0.0 | .NET 8 | ### Past Releases From 49e7bda0971e92efee52c3c38932211c47348e53 Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 16 Oct 2024 20:29:53 +0300 Subject: [PATCH 8/8] Github pipeline updates --- .github/workflows/dotnet.yml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index acc15c5..087af0d 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -15,13 +15,9 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - name: Setup .NET 6 - uses: actions/setup-dotnet@v3 - with: - dotnet-version: 6.0.x - - name: Setup .NET 8 - uses: actions/setup-dotnet@v3 + - uses: actions/checkout@v4 + - name: Setup .NET + uses: actions/setup-dotnet@v4 with: dotnet-version: 8.0.x - name: Restore dependencies