Releases: daviddotcs/safe-routing
v1.5.0
What's Changed
- Enabled
for-route
attribute on<button>
elements. This is useful in situations where you might want multiple submit buttons on a form, with each leading to a different page handler method, and can be used as an alternative to theasp-page-handler
attribute.
Merged
- Generate README.md and update package copyright on push/pull request to main by @daviddotcs in #31
- Bump Verify.Xunit from 20.8.1 to 20.8.2 in /src by @dependabot in #32
- Bump Microsoft.NET.Test.Sdk from 17.7.1 to 17.7.2 in /src by @dependabot in #33
- Bump Verify.Xunit from 20.8.2 to 21.0.0 in /src by @dependabot in #35
- Bump Meziantou.Analyzer from 2.0.82 to 2.0.83 in /src by @dependabot in #36
- Bump Meziantou.Analyzer from 2.0.83 to 2.0.84 in /src by @dependabot in #37
- Bump Verify.Xunit from 21.0.0 to 21.1.1 in /src by @dependabot in #38
- Bump Verify.Xunit from 21.1.1 to 21.1.3 in /src by @dependabot in #39
- Bump Meziantou.Analyzer from 2.0.84 to 2.0.85 in /src by @dependabot in #40
- Bump xunit from 2.5.0 to 2.5.1 in /src by @dependabot in #41
- Bump xunit.runner.visualstudio from 2.5.0 to 2.5.1 in /src by @dependabot in #42
- Bump Verify.Xunit from 21.1.3 to 21.1.4 in /src by @dependabot in #43
- Bump Verify.Xunit from 21.1.4 to 21.1.5 in /src by @dependabot in #44
- Bump Verify.Xunit from 21.1.5 to 21.2.0 in /src by @dependabot in #45
- Bump Verify.Xunit from 21.2.0 to 21.3.0 in /src by @dependabot in #46
- Bump Verify.SourceGenerators from 2.1.0 to 2.2.0 in /src by @dependabot in #47
- Bump Meziantou.Analyzer from 2.0.85 to 2.0.92 in /src by @dependabot in #48
- Bump Verify.Xunit from 21.3.0 to 22.1.0 in /src by @dependabot in #49
- Bump Verify.Xunit from 22.1.0 to 22.1.1 in /src by @dependabot in #50
- Bump Verify.Xunit from 22.1.1 to 22.1.2 in /src by @dependabot in #51
- Bump Meziantou.Analyzer from 2.0.92 to 2.0.93 in /src by @dependabot in #52
- Bump xunit.runner.visualstudio from 2.5.1 to 2.5.3 in /src by @dependabot in #54
- Bump xunit from 2.5.1 to 2.5.3 in /src by @dependabot in #57
- Bump Verify.Xunit from 22.1.2 to 22.1.4 in /src by @dependabot in #56
- Bump Meziantou.Analyzer from 2.0.93 to 2.0.94 in /src by @dependabot in #58
- Bump Meziantou.Analyzer from 2.0.94 to 2.0.98 in /src by @dependabot in #60
- Bump Meziantou.Analyzer from 2.0.98 to 2.0.100 in /src by @dependabot in #61
- Bump Meziantou.Analyzer from 2.0.100 to 2.0.105 in /src by @dependabot in #66
- Bump xunit from 2.5.3 to 2.6.1 in /src by @dependabot in #64
- Bump Meziantou.Analyzer from 2.0.105 to 2.0.106 in /src by @dependabot in #67
- Bump Microsoft.NET.Test.Sdk from 17.7.2 to 17.8.0 in /src by @dependabot in #68
- Bump Verify.Xunit from 22.1.4 to 22.2.0 in /src by @dependabot in #69
- Bump Meziantou.Analyzer from 2.0.106 to 2.0.109 in /src by @dependabot in #70
- Bump Verify.Xunit from 22.4.1 to 22.5.0 in /src by @dependabot in #74
- Bump Meziantou.Analyzer from 2.0.119 to 2.0.120 in /src by @dependabot in #84
- Bump PolySharp from 1.14.0 to 1.14.1 in /src by @dependabot in #87
- Bump Meziantou.Analyzer from 2.0.120 to 2.0.127 in /src by @dependabot in #89
Full Changelog: v1.4.0...v1.5.0
v1.4.0
What's Changed
- Added new
Path()
andUrl()
route extension methods with LinkGenerator parameters so you can generate URIs for strongly-typed routes when outside the context of a request. E.g.;route.Url(linkGenerator, "https", new HostString("example.org"))
Merged
- Bump Meziantou.Analyzer from 2.0.81 to 2.0.82 in /src by @dependabot in #22
- Bump Verify.Xunit from 20.6.0 to 20.7.0 in /src by @dependabot in #23
- Bump Verify.Xunit from 20.7.0 to 20.8.0 in /src by @dependabot in #24
- Bump Microsoft.NET.Test.Sdk from 17.7.0 to 17.7.1 in /src by @dependabot in #25
- Bump Verify.Xunit from 20.8.0 to 20.8.1 in /src by @dependabot in #26
- Add publish workflow by @daviddotcs in #27
- Fix non-deterministic method ordering by @daviddotcs in #28
- Add extensions for LinkGenerator by @daviddotcs in #30
Full Changelog: v1.3.0...v1.4.0
v1.3.0
- Added support for
[FromKeyedServices]
introduced in .NET 8 Preview 7.
Full Changelog: v1.2.3...v1.3.0
v1.2.3
- Expanded compatibility to Visual Studio 17.0 / .NET SDK 6 and above.
- Removed trailing whitespace from blank lines in generated source.
Full Changelog: v1.2.2...v1.2.3
v1.2.2
Note: This version requires .NET SDK 7.0.3xx or greater which is included with Visual Studio 17.6 or greater. Updating to v1.2.3 will restore compatibility with .NET SDK 6.0.1xx and Visual Studio 17.0.
- Added
safe_routing.generated_parameter_case
option. - Enabled
EnforceExtendedAnalyzerRules
for the source generator. - Adopted analyzer release tracking.
Full Changelog: v1.2.1...v1.2.2
v1.2.1
- Added extension methods for
IRouteValues
.
Full Changelog: v1.2.0...v1.2.1
v1.2.0
Breaking Changes
- Properties annotated with
[FromRoute]
,[FromQuery]
, or[BindProperty(SupportsGet = true)]
attributes, and properties within a class annotated with[BindProperties(SupportsGet = true)]
are now included as parameters in all generated methods for the containing class.
E.g; consider the following razor page model:
public sealed class EditModel : PageModel
{
[FromRoute]
public int ProductId { get; set; }
public void OnGet()
{
// ...
}
public void OnPost(string name)
{
// ...
}
}
The route-bound ProductId
property is added to each of the generated methods, resulting in the following method signatures:
Support.Pages_Edit.GetRouteValues Get(int productId);
Support.Pages_Edit.PostRouteValues Post(string name, int productId);
Full Changelog: v1.1.1...v1.2.0
v1.1.1
-
Source generation no longer occurs when an unsupported language version is used.
-
A
global using static
directive is now generated, removing the need for addingusing SafeRouting.Extensions;
directives in projects targeting C# 10 or later.
Full Changelog: v1.1.0...v1.1.1
v1.1.0
-
Added slight optimisations to code generation and generated parameter code.
-
Added support for controllers declared as records.
-
Added
[ExcludeFromCodeCoverage]
attributes and#pragma warning disable
to generated code. -
All reported diagnostics are now included in the
SafeRouting.Generator.RouteGenerator
category, rather thanFoundation
. -
Default parameter values now more closely resemble the expressions they're based on, e.g.;
DayOfWeek x = DayOfWeek.Wednesday
producesglobal::System.DayOfWeek x = global::System.DayOfWeek.Wednesday
instead ofglobal::System.DayOfWeek x = (global::System.DayOfWeek)3
.
Breaking Changes
-
Handle controller/property/method/parameter names which need to be
@
escaped. Names assigned with[RouteGeneratorName]
may no longer contain@
, e.g.;[RouteGeneratorName("@class")]
must be changed to[RouteGeneratorName("class")]
. -
The generated
...RouteValues
classes now have a constructor with a singleRouteValueDictionary
parameter instead of using a default constructor.
Full Changelog: v1.0.2...v1.1.0
v1.0.2
-
Fixes incorrect suggested return type in XML documentation for
Redirect
extension methods. -
Adds missing source link for NuGet package.
-
RouteValue indexers now fall back to a nullable disabled context when there are multiple properties or parameters with incompatible nullable reference types. This avoids requiring the null-forgiving operator in those cases.
E.g.; Source class:
public class ProductsController : Controller
{
public IActionResult Index(IEnumerable<string?> x, IEnumerable<string>? y) => View();
}
Resulting indexer on the associated RouteValues class:
#nullable disable
public IEnumerable<string> this[RouteKey<ParameterData, IEnumerable<string>> key] { set => RouteValues[key.Name] = value; }
#nullable restore
Full Changelog: v1.0.1...v1.0.2