diff --git a/FastEndpoints.TemplatePack.csproj b/FastEndpoints.TemplatePack.csproj index 1d39fa5..e8d7afb 100644 --- a/FastEndpoints.TemplatePack.csproj +++ b/FastEndpoints.TemplatePack.csproj @@ -2,7 +2,7 @@ - 1.3.2 + 1.3.3 Template FastEndpoints.TemplatePack diff --git a/changelog.md b/changelog.md index b9ff8cb..00ab881 100644 --- a/changelog.md +++ b/changelog.md @@ -1 +1,3 @@ +- upgrade dependencies to latest +- minor template refactoring - update `.editorconfig` file \ No newline at end of file diff --git a/templates/project/.editorconfig b/templates/project/.editorconfig index 5b88e74..f51bd40 100644 --- a/templates/project/.editorconfig +++ b/templates/project/.editorconfig @@ -1,112 +1,74 @@ -[*.cs] -csharp_indent_braces = false -csharp_indent_labels = no_change -csharp_new_line_before_catch = true -csharp_new_line_before_else = true -csharp_new_line_before_members_in_anonymous_types = false -csharp_new_line_before_members_in_object_initializers = false -csharp_new_line_before_open_brace = all -csharp_prefer_braces = false:suggestion -csharp_prefer_simple_default_expression = true -csharp_prefer_simple_using_statement = true:suggestion -csharp_preferred_modifier_order = public, protected, private, internal, static, abstract, virtual, readonly, sealed, override, async:suggestion -csharp_preserve_single_line_blocks = true -csharp_preserve_single_line_statements = true -csharp_space_after_cast = false -csharp_space_after_colon_in_inheritance_clause = true -csharp_space_after_keywords_in_control_flow_statements = true -csharp_space_before_colon_in_inheritance_clause = true -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_parameter_list_parentheses = false -csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true:silent -csharp_style_allow_blank_lines_between_consecutive_braces_experimental = false:suggestion -csharp_style_allow_embedded_statements_on_same_line_experimental = true:silent -csharp_style_expression_bodied_accessors = true:suggestion -csharp_style_expression_bodied_constructors = false:error -csharp_style_expression_bodied_indexers = true:suggestion -csharp_style_expression_bodied_lambdas = true:suggestion -csharp_style_expression_bodied_local_functions = true:suggestion -csharp_style_expression_bodied_methods = when_on_single_line:suggestion -csharp_style_expression_bodied_operators = true:suggestion -csharp_style_expression_bodied_properties = true:suggestion -csharp_style_implicit_object_creation_when_type_is_apparent = true -csharp_style_inlined_variable_declaration = true:suggestion -csharp_style_namespace_declarations = file_scoped -csharp_style_pattern_local_over_anonymous_function = true:suggestion -csharp_style_pattern_matching_over_as_with_null_check = true:suggestion -csharp_style_prefer_extended_property_pattern = true:suggestion -csharp_style_prefer_index_operator = true:suggestion -csharp_style_prefer_local_over_anonymous_function = true:suggestion -csharp_style_prefer_null_check_over_type_check = true -csharp_style_prefer_range_operator = true:suggestion -csharp_style_prefer_tuple_swap = true:suggestion -csharp_style_throw_expression = true:suggestion -csharp_style_var_elsewhere = true -csharp_style_var_for_built_in_types = true -csharp_style_var_when_type_is_apparent = true -csharp_using_directive_placement = outside_namespace -dotnet_diagnostic.ca2007.severity = silent -dotnet_diagnostic.rcs1158.severity = silent -dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion -dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i -dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface -dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion -dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case -dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members -dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion -dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case -dotnet_naming_rule.types_should_be_pascal_case.symbols = types -dotnet_naming_style.begins_with_i.capitalization = pascal_case -dotnet_naming_style.begins_with_i.required_prefix = I -dotnet_naming_style.begins_with_i.word_separator = -dotnet_naming_style.pascal_case.capitalization = pascal_case -dotnet_naming_style.pascal_case.capitalization = pascal_case -dotnet_naming_style.pascal_case.required_prefix = -dotnet_naming_style.pascal_case.required_suffix = -dotnet_naming_style.pascal_case.word_separator = -dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected -dotnet_naming_symbols.interface.applicable_kinds = interface -dotnet_naming_symbols.interface.required_modifiers = -dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected -dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method -dotnet_naming_symbols.non_field_members.required_modifiers = -dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected -dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum -dotnet_naming_symbols.types.required_modifiers = -dotnet_sort_system_directives_first = false -dotnet_style_allow_multiple_blank_lines_experimental = false -dotnet_style_allow_statement_immediately_after_block_experimental = false -dotnet_style_coalesce_expression = true -dotnet_style_collection_initializer = true -dotnet_style_explicit_tuple_names = true -dotnet_style_namespace_match_folder = true:suggestion -dotnet_style_null_propagation = true -dotnet_style_object_initializer = true -dotnet_style_object_initializer = true:suggestion -dotnet_style_operator_placement_when_wrapping = beginning_of_line -dotnet_style_predefined_type_for_locals_parameters_members = true -dotnet_style_predefined_type_for_member_access = true -dotnet_style_prefer_auto_properties = true -dotnet_style_prefer_compound_assignment = true -dotnet_style_prefer_conditional_expression_over_assignment = true -dotnet_style_prefer_conditional_expression_over_return = true:suggestion -dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion -dotnet_style_prefer_inferred_tuple_names = true:suggestion -dotnet_style_prefer_is_null_check_over_reference_equality_method = true -dotnet_style_prefer_simplified_boolean_expressions = true -dotnet_style_prefer_simplified_interpolation = true -dotnet_style_qualification_for_field = false -dotnet_style_qualification_for_method = false -dotnet_style_qualification_for_property = false -dotnet_style_require_accessibility_modifiers = never:warning +[*] +charset = utf-8 end_of_line = crlf -indent_size = 4 +insert_final_newline = false indent_style = space -tab_width = 4 -resharper_arrange_local_function_body_highlighting = suggestion +indent_size = 4 + +[{*.har,*.json}] +indent_size = 2 + +[*.cs] +csharp_new_line_before_members_in_object_initializers = false +csharp_new_line_between_query_expression_clauses = false +csharp_preferred_modifier_order = public, private, protected, internal, file, new, static, abstract, virtual, sealed, readonly, override, extern, unsafe, volatile, async, required:suggestion +csharp_style_prefer_utf8_string_literals = true:suggestion +csharp_style_var_elsewhere = true:suggestion +csharp_style_var_for_built_in_types = true:suggestion +csharp_style_var_when_type_is_apparent = true:suggestion +dotnet_naming_rule.parameters_rule.import_to_resharper = as_predefined +dotnet_naming_rule.parameters_rule.resharper_style = aaBb, AaBb +dotnet_naming_rule.parameters_rule.severity = warning +dotnet_naming_rule.parameters_rule.style = lower_camel_case_style_1 +dotnet_naming_rule.parameters_rule.symbols = parameters_symbols +dotnet_naming_rule.private_constants_rule.import_to_resharper = as_predefined +dotnet_naming_rule.private_constants_rule.severity = warning +dotnet_naming_rule.private_constants_rule.style = upper_camel_case_style +dotnet_naming_rule.private_constants_rule.symbols = private_constants_symbols +dotnet_naming_rule.private_static_readonly_rule.import_to_resharper = as_predefined +dotnet_naming_rule.private_static_readonly_rule.severity = warning +dotnet_naming_rule.private_static_readonly_rule.style = lower_camel_case_style +dotnet_naming_rule.private_static_readonly_rule.symbols = private_static_readonly_symbols +dotnet_naming_style.lower_camel_case_style.capitalization = camel_case +dotnet_naming_style.lower_camel_case_style.required_prefix = _ +dotnet_naming_style.lower_camel_case_style_1.capitalization = camel_case +dotnet_naming_style.upper_camel_case_style.capitalization = pascal_case +dotnet_naming_symbols.parameters_symbols.applicable_accessibilities = * +dotnet_naming_symbols.parameters_symbols.applicable_kinds = parameter +dotnet_naming_symbols.private_constants_symbols.applicable_accessibilities = private +dotnet_naming_symbols.private_constants_symbols.applicable_kinds = field +dotnet_naming_symbols.private_constants_symbols.required_modifiers = const +dotnet_naming_symbols.private_static_readonly_symbols.applicable_accessibilities = private +dotnet_naming_symbols.private_static_readonly_symbols.applicable_kinds = field +dotnet_naming_symbols.private_static_readonly_symbols.required_modifiers = static, readonly +dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary:none +dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:none +dotnet_style_parentheses_in_relational_binary_operators = never_if_unnecessary:none +dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion +dotnet_style_predefined_type_for_member_access = true:suggestion +dotnet_style_qualification_for_event = false:suggestion +dotnet_style_qualification_for_field = false:suggestion +dotnet_style_qualification_for_method = false:suggestion +dotnet_style_qualification_for_property = false:suggestion +dotnet_style_require_accessibility_modifiers = never:error + +resharper_align_linq_query = true +resharper_align_multiline_binary_patterns = true +resharper_align_multiline_calls_chain = true +resharper_align_multiline_expression = true +resharper_align_multiline_extends_list = true +resharper_align_multiline_parameter = true +resharper_align_multiple_declaration = true +resharper_align_multline_type_parameter_constrains = true +resharper_align_multline_type_parameter_list = true +resharper_align_tuple_components = true +resharper_apply_auto_detected_rules = false +resharper_autodetect_indent_settings = true +resharper_blank_lines_after_block_statements = 0 +resharper_blank_lines_after_control_transfer_statements = 1 +resharper_blank_lines_before_block_statements = 1 +resharper_blank_lines_before_control_transfer_statements = 1 +resharper_blank_lines_before_single_line_comment = 1 resharper_braces_for_dowhile = required_for_multiline resharper_braces_for_fixed = required_for_multiline resharper_braces_for_for = required_for_multiline @@ -115,5 +77,103 @@ resharper_braces_for_ifelse = required_for_multiline resharper_braces_for_lock = required_for_multiline resharper_braces_for_using = required_for_multiline resharper_braces_for_while = required_for_multiline +resharper_csharp_empty_block_style = together_same_line +resharper_csharp_int_align_comments = true +resharper_csharp_keep_blank_lines_in_code = 1 +resharper_csharp_keep_blank_lines_in_declarations = 1 +resharper_csharp_stick_comment = false +resharper_csharp_wrap_after_invocation_lpar = true +resharper_csharp_wrap_arguments_style = chop_if_long +resharper_csharp_wrap_before_first_type_parameter_constraint = true +resharper_csharp_wrap_multiple_declaration_style = chop_always +resharper_csharp_wrap_parameters_style = chop_if_long +resharper_enforce_line_ending_style = true +resharper_force_attribute_style = join +resharper_formatter_off_tag = @formatter:off +resharper_formatter_on_tag = @formatter:on +resharper_formatter_tags_enabled = true +resharper_indent_nested_fixed_stmt = true +resharper_indent_nested_foreach_stmt = true +resharper_indent_nested_for_stmt = true +resharper_indent_nested_lock_stmt = true +resharper_indent_nested_usings_stmt = true +resharper_indent_nested_while_stmt = true +resharper_indent_preprocessor_if = outdent +resharper_indent_preprocessor_other = outdent +resharper_indent_preprocessor_region = outdent +resharper_keep_existing_declaration_parens_arrangement = false +resharper_keep_existing_embedded_arrangement = false +resharper_keep_existing_embedded_block_arrangement = true +resharper_keep_existing_expr_member_arrangement = false +resharper_keep_existing_invocation_parens_arrangement = false +resharper_keep_existing_property_patterns_arrangement = false +resharper_keep_existing_switch_expression_arrangement = false resharper_local_function_body = expression_body -resharper_use_heuristics_for_body_style = true \ No newline at end of file +resharper_max_array_initializer_elements_on_line = 10 +resharper_max_enum_members_on_line = 1 +resharper_max_formal_parameters_on_line = 10 +resharper_max_invocation_arguments_on_line = 10 +resharper_method_or_operator_body = expression_body +resharper_object_creation_when_type_not_evident = target_typed +resharper_place_accessorholder_attribute_on_same_line = false +resharper_place_accessor_with_attrs_holder_on_single_line = true +resharper_place_expr_method_on_single_line = false +resharper_place_linq_into_on_new_line = false +resharper_place_simple_embedded_statement_on_same_line = false +resharper_place_simple_method_on_single_line = true +resharper_show_autodetect_configure_formatting_tip = false +resharper_space_within_slice_pattern = false +resharper_use_continuous_indent_inside_initializer_braces = false +resharper_use_indent_from_vs = false +resharper_wrap_array_initializer_style = chop_if_long +resharper_wrap_before_arrow_with_expressions = true +resharper_wrap_before_binary_pattern_op = false +resharper_wrap_chained_binary_expressions = chop_if_long +resharper_wrap_chained_binary_patterns = chop_if_long +resharper_xmldoc_blank_line_after_pi = false +resharper_xmldoc_indent_text = ZeroIndent + +resharper_arrange_attributes_highlighting = suggestion +resharper_arrange_constructor_or_destructor_body_highlighting = suggestion +resharper_arrange_default_value_when_type_not_evident_highlighting = suggestion +resharper_arrange_local_function_body_highlighting = suggestion +resharper_arrange_method_or_operator_body_highlighting = hint +resharper_arrange_null_checking_pattern_highlighting = suggestion +resharper_arrange_object_creation_when_type_not_evident_highlighting = suggestion +resharper_arrange_redundant_parentheses_highlighting = hint +resharper_arrange_this_qualifier_highlighting = hint +resharper_auto_property_can_be_made_get_only_global_highlighting = none +resharper_built_in_type_reference_style_for_member_access_highlighting = hint +resharper_built_in_type_reference_style_highlighting = hint +resharper_check_namespace_highlighting = none +resharper_class_never_instantiated_global_highlighting = none +resharper_class_with_virtual_members_never_inherited_global_highlighting = none +resharper_collection_never_updated_global_highlighting = none +resharper_co_variant_array_conversion_highlighting = hint +resharper_empty_for_statement_highlighting = none +resharper_for_can_be_converted_to_foreach_highlighting = none +resharper_loop_can_be_converted_to_query_highlighting = none +resharper_member_can_be_private_global_highlighting = none +resharper_parameter_hides_member_highlighting = none +resharper_possible_multiple_enumeration_highlighting = suggestion +resharper_redundant_base_qualifier_highlighting = warning +resharper_return_value_of_pure_method_is_not_used_highlighting = none +resharper_separate_local_functions_with_jump_statement_highlighting = none +resharper_static_member_in_generic_type_highlighting = none +resharper_suggest_base_type_for_parameter_in_constructor_highlighting = suggestion +resharper_suggest_var_or_type_built_in_types_highlighting = hint +resharper_suggest_var_or_type_elsewhere_highlighting = hint +resharper_suggest_var_or_type_simple_types_highlighting = hint +resharper_switch_expression_handles_some_known_enum_values_with_exception_in_default_highlighting = suggestion +resharper_switch_statement_handles_some_known_enum_values_with_default_highlighting = suggestion +resharper_switch_statement_missing_some_enum_cases_no_default_highlighting = suggestion +resharper_unused_auto_property_accessor_global_highlighting = none +resharper_unused_auto_property_accessor_local_highlighting = none +resharper_unused_member_global_highlighting = none +resharper_unused_method_return_value_global_highlighting = none +resharper_web_config_module_not_resolved_highlighting = warning +resharper_web_config_type_not_resolved_highlighting = warning +resharper_web_config_wrong_module_highlighting = warning + +[{*Request.cs,*Response.cs,*Models.cs,*Endpoint.cs}] +dotnet_diagnostic.CS8618.severity = none \ No newline at end of file diff --git a/templates/project/Source/Features/.editorconfig b/templates/project/Source/Features/.editorconfig deleted file mode 100644 index 993471d..0000000 --- a/templates/project/Source/Features/.editorconfig +++ /dev/null @@ -1,3 +0,0 @@ -# CS8618: Non-nullable field is uninitialized. Consider declaring as nullable. -[{*Request*.cs,*Response*.cs,*Model*.cs}] -dotnet_diagnostic.CS8618.severity = none \ No newline at end of file diff --git a/templates/project/Source/Features/SayHello/Models.cs b/templates/project/Source/Features/SayHello/Models.cs deleted file mode 100644 index 86b2a72..0000000 --- a/templates/project/Source/Features/SayHello/Models.cs +++ /dev/null @@ -1,23 +0,0 @@ -using FluentValidation; - -namespace SayHello; - -sealed class Request -{ - public string FirstName { get; set; } - public string LastName { get; set; } -} - -sealed class Validator : Validator -{ - public Validator() - { - RuleFor(x => x.FirstName).MinimumLength(3); - RuleFor(x => x.LastName).MinimumLength(5); - } -} - -sealed class Response -{ - public string Message { get; set; } -} diff --git a/templates/project/Source/Features/SayHello/Request.cs b/templates/project/Source/Features/SayHello/Request.cs new file mode 100644 index 0000000..c1cdc11 --- /dev/null +++ b/templates/project/Source/Features/SayHello/Request.cs @@ -0,0 +1,18 @@ +using FluentValidation; + +namespace SayHello; + +sealed class Request +{ + public string FirstName { get; set; } + public string LastName { get; set; } + + sealed class Validator : Validator + { + public Validator() + { + RuleFor(x => x.FirstName).MinimumLength(3); + RuleFor(x => x.LastName).MinimumLength(5); + } + } +} \ No newline at end of file diff --git a/templates/project/Source/Features/SayHello/Response.cs b/templates/project/Source/Features/SayHello/Response.cs new file mode 100644 index 0000000..8ae48e0 --- /dev/null +++ b/templates/project/Source/Features/SayHello/Response.cs @@ -0,0 +1,6 @@ +namespace SayHello; + +sealed class Response +{ + public string Message { get; set; } +} \ No newline at end of file diff --git a/templates/project/Source/MyProject.csproj b/templates/project/Source/MyProject.csproj index c37e2bf..11e577b 100644 --- a/templates/project/Source/MyProject.csproj +++ b/templates/project/Source/MyProject.csproj @@ -10,9 +10,9 @@ - - - + + + diff --git a/templates/project/Source/Program.cs b/templates/project/Source/Program.cs index 12373eb..9aeee9b 100644 --- a/templates/project/Source/Program.cs +++ b/templates/project/Source/Program.cs @@ -2,13 +2,11 @@ var bld = WebApplication.CreateBuilder(args); bld.Services - .AddAuthorization() .AddFastEndpoints() .SwaggerDocument(); var app = bld.Build(); -app.UseAuthorization() - .UseFastEndpoints() +app.UseFastEndpoints() .UseSwaggerGen(); app.Run(); diff --git a/templates/project/Tests/Metadata.cs b/templates/project/Tests/Metadata.cs index 59f003f..2e8e6b2 100644 --- a/templates/project/Tests/Metadata.cs +++ b/templates/project/Tests/Metadata.cs @@ -1,6 +1,7 @@ global using FastEndpoints; global using FastEndpoints.Testing; global using FluentAssertions; +global using Microsoft.Extensions.DependencyInjection; global using System.Net; global using Xunit; global using Xunit.Abstractions; diff --git a/templates/project/Tests/SayHello/Fixture.cs b/templates/project/Tests/SayHello/Fixture.cs index a8a01a7..f8af117 100644 --- a/templates/project/Tests/SayHello/Fixture.cs +++ b/templates/project/Tests/SayHello/Fixture.cs @@ -1,6 +1,4 @@ -using Microsoft.Extensions.DependencyInjection; - -namespace Tests.SayHello; +namespace Tests.SayHello; public class Fixture : TestFixture { diff --git a/templates/project/Tests/Tests.csproj b/templates/project/Tests/Tests.csproj index 495fff0..0dcaf0a 100644 --- a/templates/project/Tests/Tests.csproj +++ b/templates/project/Tests/Tests.csproj @@ -8,11 +8,11 @@ - + - - + +