Skip to content

7.0.1 Patches #1018

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Aug 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
"version": 1,
"isRoot": true,
"tools": {
"signclient": {
"version": "1.3.155",
"sign": {
"version": "0.9.1-beta.23356.1",
"commands": [
"SignClient"
"sign"
]
}
}
Expand Down
3 changes: 2 additions & 1 deletion build/nuget.props
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@

<!-- REF: https://github.com/dotnet/sourcelink/blob/master/README.md -->
<PropertyGroup Label="SourceLink">
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>

<!-- REF: https://github.com/clairernovotny/DeterministicBuilds -->
<ContinuousIntegrationBuild Condition=" ('$(TF_BUILD)' == 'true') OR ('$(GITHUB_ACTIONS)' == 'true') ">true</ContinuousIntegrationBuild>
Expand Down
13 changes: 0 additions & 13 deletions build/signing.json

This file was deleted.

35 changes: 13 additions & 22 deletions build/steps-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,32 +25,23 @@ steps:
- script: dotnet tool restore
displayName: Restore Tools

- pwsh: >
Compress-Archive
-Path $(Build.ArtifactStagingDirectory)/packages/*
-DestinationPath $(Build.ArtifactStagingDirectory)/packages.zip
displayName: Package Artifacts for Signing

- script: >
dotnet signclient sign
--config build/signing.json
--input $(Build.ArtifactStagingDirectory)/packages.zip
--user "$(codesign_user)"
--secret "$(codesign_secret)"
--name "ASP.NET API Versioning"
--description "Adds versioning semantics to APIs built with ASP.NET"
--descriptionUrl "https://github.com/dotnet/aspnet-api-versioning"
dotnet sign code azure-key-vault "*.nupkg" `
--base-directory "$(Build.ArtifactStagingDirectory)/packages" `
--publisher-name "ASP.NET API Versioning" `
--description "Adds versioning semantics to APIs built with ASP.NET" `
--description-url "https://github.com/dotnet/aspnet-api-versioning" `
--azure-key-vault-tenant-id "$(SignTenantId)" `
--azure-key-vault-client-id "$(SignClientId)" `
--azure-key-vault-client-secret '$(SignClientSecret)' `
--azure-key-vault-certificate "$(SignKeyVaultCertificate)" `
--azure-key-vault-url "$(SignKeyVaultUrl)"
--timestamp-url http://timestamp.digicert.com
displayName: Sign Artifacts

- pwsh: >
Expand-Archive
-Path $(Build.ArtifactStagingDirectory)/packages.zip
-DestinationPath $(Build.ArtifactStagingDirectory)/signed-packages
displayName: Extract Signed Artifacts

- task: PublishBuildArtifacts@1
displayName: Publish package artifacts
displayName: Publish Artifacts
inputs:
pathToPublish: $(Build.ArtifactStagingDirectory)/signed-packages
pathToPublish: $(Build.ArtifactStagingDirectory)/packages
publishLocation: Container
artifactName: NuGet Packages
15 changes: 10 additions & 5 deletions build/test.targets
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@

<PropertyGroup>
<FluentAssertionsVersion>6.8.0</FluentAssertionsVersion>
<MoqVersion>4.18.3</MoqVersion>
<XunitRunnerVersion>2.4.5</XunitRunnerVersion>

<!--
beware of other versions that may contain SponsorLink
REF: https://github.com/moq/moq/issues/1372
-->
<MoqVersion>4.20.69</MoqVersion>
<XunitRunnerVersion>2.5.0</XunitRunnerVersion>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'net452' ">
Expand All @@ -15,14 +20,14 @@

<ItemGroup Condition=" '$(IsSharedProject)' == 'false' ">
<PackageReference Include="FluentAssertions" Version="$(FluentAssertionsVersion)" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0-*" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.0-*" />
<PackageReference Include="Moq" Version="$(MoqVersion)" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit" Version="2.5.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="$(XunitRunnerVersion)" />
</ItemGroup>

<ItemGroup Condition=" '$(IsAspNetCore)' == 'true' ">
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="7.0.0" />
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="7.0.10" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public void Apply( ODataModelBuilder builder, ApiVersion apiVersion, string rout

person.HasKey( p => p.Id );
person.Select().OrderBy( "firstName", "lastName" );
person.Page( maxTopValue: 100, pageSizeValue: default );

if ( apiVersion < ApiVersions.V3 )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ public void Apply( ODataModelBuilder builder, ApiVersion apiVersion, string rout
return;
}

var product = builder.EntitySet<Product>( "Products" ).EntityType.HasKey( p => p.Id );
var product = builder.EntitySet<Product>( "Products" ).EntityType;

product.HasKey( p => p.Id );
product.Page( maxTopValue: 100, pageSizeValue: default );
product.Action( "Rate" ).Parameter<int>( "stars" );
product.Collection.Action( "Rate" ).Parameter<int>( "stars" );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ public void Apply( ODataModelBuilder builder, ApiVersion apiVersion, string rout
return;
}

builder.EntitySet<Supplier>( "Suppliers" ).EntityType.HasKey( p => p.Id );
var supplier = builder.EntitySet<Supplier>( "Suppliers" ).EntityType;

supplier.HasKey( p => p.Id );
supplier.Page( maxTopValue: 100, pageSizeValue: default );

builder.Singleton<Supplier>( "Acme" );
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
/// <summary>
/// Represents an order.
/// </summary>
[Page( MaxTop = 100 )]
[Select]
[Select( "effectiveDate", SelectType = SelectExpandType.Disabled )]
public class Order
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public IHttpActionResult Put( [FromODataUri] int key, [FromBody] Supplier update
/// </summary>
/// <param name="key">The supplier identifier.</param>
/// <returns>The associated supplier products.</returns>
[EnableQuery]
[EnableQuery( MaxTop = 100 )]
public IQueryable<Product> GetProducts( [FromODataUri] int key ) =>
suppliers.Where( s => s.Id == key ).SelectMany( s => s.Products );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public void Apply( ODataModelBuilder builder, ApiVersion apiVersion, string rout

person.HasKey( p => p.Id );
person.Select().OrderBy( "firstName", "lastName" );
person.Page( maxTopValue: 100, pageSizeValue: default );

if ( apiVersion < ApiVersions.V3 )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ public void Apply( ODataModelBuilder builder, ApiVersion apiVersion, string rout
return;
}

var product = builder.EntitySet<Product>( "Products" ).EntityType.HasKey( p => p.Id );
var product = builder.EntitySet<Product>( "Products" ).EntityType;

product.HasKey( p => p.Id );
product.Page( maxTopValue: 100, pageSizeValue: default );
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ public void Apply( ODataModelBuilder builder, ApiVersion apiVersion, string rout
return;
}

builder.EntitySet<Supplier>( "Suppliers" ).EntityType.HasKey( p => p.Id );
var supplier = builder.EntitySet<Supplier>( "Suppliers" ).EntityType;


supplier.HasKey( p => p.Id );
supplier.Page( maxTopValue: 100, pageSizeValue: default );

builder.Singleton<Supplier>( "Acme" );
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
/// <summary>
/// Represents an order.
/// </summary>
[Page( MaxTop = 100 )]
[Select]
[Select( "effectiveDate", SelectType = SelectExpandType.Disabled )]
public class Order
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
public class SuppliersController : ODataController
{
private readonly IQueryable<Supplier> suppliers = new[]
{
NewSupplier( 1 ),
NewSupplier( 2 ),
{
NewSupplier( 1 ),
NewSupplier( 2 ),
NewSupplier( 3 ),
}.AsQueryable();

Expand All @@ -46,7 +46,7 @@ public class SuppliersController : ODataController
[Produces( "application/json" )]
[ProducesResponseType( typeof( Supplier ), Status200OK )]
[ProducesResponseType( Status404NotFound )]
public SingleResult<Supplier> Get( int key ) =>
public SingleResult<Supplier> Get( int key ) =>
SingleResult.Create( suppliers.Where( p => p.Id == key ) );

/// <summary>
Expand Down Expand Up @@ -147,7 +147,7 @@ public IActionResult Put( int key, [FromBody] Supplier update )
/// <param name="key">The supplier identifier.</param>
/// <returns>The associated supplier products.</returns>
[HttpGet]
[EnableQuery]
[EnableQuery( MaxTop = 100 )]
public IQueryable<Product> GetProducts( int key ) =>
suppliers.Where( s => s.Id == key ).SelectMany( s => s.Products );

Expand Down Expand Up @@ -181,8 +181,8 @@ public IActionResult CreateRef(
[ProducesResponseType( Status204NoContent )]
[ProducesResponseType( Status404NotFound )]
public IActionResult DeleteRef(
int key,
int relatedKey,
int key,
int relatedKey,
string navigationProperty ) => NoContent();

private static Supplier NewSupplier( int id ) =>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<VersionPrefix>7.0.3</VersionPrefix>
<VersionPrefix>7.0.4</VersionPrefix>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<TargetFrameworks>net45;net472</TargetFrameworks>
<RootNamespace>Asp.Versioning</RootNamespace>
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Fix: Explore model per EDM + API version ([#996](https://github.com/dotnet/aspnet-api-versioning/issues/996))
Publish NuGet symbol package
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<VersionPrefix>7.0.1</VersionPrefix>
<VersionPrefix>7.0.2</VersionPrefix>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<TargetFrameworks>net45;net472</TargetFrameworks>
<RootNamespace>Asp.Versioning</RootNamespace>
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Fix empty EDM detection
Publish NuGet symbol package
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<VersionPrefix>7.0.0</VersionPrefix>
<VersionPrefix>7.0.1</VersionPrefix>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<TargetFrameworks>net45;net472</TargetFrameworks>
<AssemblyTitle>ASP.NET Web API Versioning API Explorer</AssemblyTitle>
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@

Publish NuGet symbol package
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<VersionPrefix>7.0.0</VersionPrefix>
<VersionPrefix>7.0.1</VersionPrefix>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<TargetFrameworks>net45;net472</TargetFrameworks>
<AssemblyTitle>ASP.NET Web API Versioning</AssemblyTitle>
Expand Down
4 changes: 3 additions & 1 deletion src/AspNet/WebApi/src/Asp.Versioning.WebApi/ReleaseNotes.txt
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@

Publish NuGet symbol package
Resolved [#1015](https://github.com/dotnet/aspnet-api-versioning/issues/1011)
Fixed [#1017](https://github.com/dotnet/aspnet-api-versioning/issues/1017)
9 changes: 9 additions & 0 deletions src/AspNet/WebApi/src/Asp.Versioning.WebApi/SR.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions src/AspNet/WebApi/src/Asp.Versioning.WebApi/SR.resx
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,14 @@
<data name="DirectRoute_AmbiguousController" xml:space="preserve">
<value>Multiple controller types were found that match the URL. This can happen if attribute routes on multiple controllers match the requested URL.{1}{1}The request has found the following matching controller types: {0}</value>
</data>
<data name="InvalidDefaultApiVersion" xml:space="preserve">
<value>{0}.{1} is an invalid value for {2}.{3}. Did you mean to apply {4} via attribute or convention instead?</value>
<comment>0 = ApiVersion
1 = Neutral
2 = ApiVersioningOptions
3 = DefaultApiVersion
4 = IApiVersionNeutral</comment>
</data>
<data name="NoControllerSelected" xml:space="preserve">
<value>A controller was not selected for request URI '{0}' and API version '{1}'.</value>
</data>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ namespace System.Web.Http;
using Asp.Versioning;
using Asp.Versioning.Controllers;
using Asp.Versioning.Dispatcher;
using System.Globalization;
using System.Web.Http.Controllers;
using System.Web.Http.Dispatcher;
using static Asp.Versioning.ApiVersionParameterLocation;
Expand Down Expand Up @@ -65,6 +66,7 @@ public static void AddApiVersioning( this HttpConfiguration configuration, Actio
var options = new ApiVersioningOptions();

setupAction( options );
ValidateApiVersioningOptions( options );
configuration.AddApiVersioning( options );
}

Expand Down Expand Up @@ -97,6 +99,30 @@ private static void AddApiVersioning( this HttpConfiguration configuration, ApiV
SunsetPolicyManager.Default = new SunsetPolicyManager( options );
}

// ApiVersion.Neutral does not have the same meaning as IApiVersionNeutral. setting
// ApiVersioningOptions.DefaultApiVersion this value will not make all APIs version-neutral
// and will likely lead to many unexpected side effects. this is a best-effort, one-time
// validation check to help prevent people from going off the rails. if someone bypasses
// this validation by removing the check or updating the value later, then caveat emptor.
//
// REF: https://github.com/dotnet/aspnet-api-versioning/issues/1011
private static void ValidateApiVersioningOptions( ApiVersioningOptions options )
{
if ( options.DefaultApiVersion == ApiVersion.Neutral )
{
var message = string.Format(
CultureInfo.CurrentCulture,
SR.InvalidDefaultApiVersion,
nameof( ApiVersion ),
nameof( ApiVersion.Neutral ),
nameof( ApiVersioningOptions ),
nameof( ApiVersioningOptions.DefaultApiVersion ),
nameof( IApiVersionNeutral ) );

throw new InvalidOperationException( message );
}
}

internal static IReportApiVersions GetApiVersionReporter( this HttpConfiguration configuration )
{
var options = configuration.GetApiVersioningOptions();
Expand Down
Loading