diff --git a/Dockerfile b/Dockerfile index 5a25e695..5bff5e83 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ # Learn about building .NET container images: # https://github.com/dotnet/dotnet-docker/blob/main/samples/README.md -FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0.420-alpine3.23 AS build +FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:10.0.203-alpine3.23 AS build ARG TARGETARCH WORKDIR /source @@ -15,7 +15,7 @@ RUN \ # Enable globalization and time zones: # https://github.com/dotnet/dotnet-docker/blob/main/samples/enable-globalization.md # final stage/image -FROM mcr.microsoft.com/dotnet/aspnet:8.0.26-alpine3.23 +FROM mcr.microsoft.com/dotnet/aspnet:10.0.7-alpine3.23 EXPOSE 8080 ENV \ diff --git a/Px.Abstractions/Px.Abstractions.csproj b/Px.Abstractions/Px.Abstractions.csproj index 1ca45065..a392ab10 100644 --- a/Px.Abstractions/Px.Abstractions.csproj +++ b/Px.Abstractions/Px.Abstractions.csproj @@ -1,7 +1,7 @@ - net8.0 + net10.0 enable enable @@ -15,6 +15,7 @@ + diff --git a/Px.Search.Lucene/Px.Search.Lucene.csproj b/Px.Search.Lucene/Px.Search.Lucene.csproj index c3c6b6e4..fa6053c1 100644 --- a/Px.Search.Lucene/Px.Search.Lucene.csproj +++ b/Px.Search.Lucene/Px.Search.Lucene.csproj @@ -1,7 +1,7 @@  - net8.0 + net10.0 enable enable @@ -18,7 +18,7 @@ - + diff --git a/Px.Search/Px.Search.csproj b/Px.Search/Px.Search.csproj index 8d7a7874..555545c2 100644 --- a/Px.Search/Px.Search.csproj +++ b/Px.Search/Px.Search.csproj @@ -1,7 +1,7 @@ - net8.0 + net10.0 enable enable @@ -15,18 +15,18 @@ - + - - - - <_Parameter1>Px.Search.Tests - - + + + + <_Parameter1>Px.Search.Tests + + diff --git a/PxWeb.UnitTests/PxWeb.UnitTests.csproj b/PxWeb.UnitTests/PxWeb.UnitTests.csproj index 2eaa8fcc..c081cda8 100644 --- a/PxWeb.UnitTests/PxWeb.UnitTests.csproj +++ b/PxWeb.UnitTests/PxWeb.UnitTests.csproj @@ -1,7 +1,7 @@ - net8.0 + net10.0 enable false @@ -17,11 +17,11 @@ - + - - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/PxWeb/Filters/Api2/BasePathFilter.cs b/PxWeb/Filters/Api2/BasePathFilter.cs deleted file mode 100644 index c9da6d85..00000000 --- a/PxWeb/Filters/Api2/BasePathFilter.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System.Linq; -using System.Text.RegularExpressions; - -using Microsoft.OpenApi.Models; - -using Swashbuckle.AspNetCore.SwaggerGen; - -namespace PxWeb.Filters.Api2 -{ - /// - /// BasePath Document Filter sets BasePath property of Swagger and removes it from the individual URL paths - /// - public class BasePathFilter : IDocumentFilter - { - /// - /// Constructor - /// - /// BasePath to remove from Operations - public BasePathFilter(string basePath) - { - BasePath = basePath; - } - - /// - /// Gets the BasePath of the Swagger Doc - /// - /// The BasePath of the Swagger Doc - public string BasePath { get; } - - /// - /// Apply the filter - /// - /// OpenApiDocument - /// FilterContext - public void Apply(OpenApiDocument swaggerDoc, DocumentFilterContext context) - { - swaggerDoc.Servers.Add(new OpenApiServer() { Url = this.BasePath }); - - var pathsToModify = swaggerDoc.Paths.Where(p => p.Key.StartsWith(this.BasePath)).ToList(); - - foreach (var path in pathsToModify) - { - if (path.Key.StartsWith(this.BasePath)) - { - string newKey = Regex.Replace(path.Key, $"^{this.BasePath}", string.Empty, RegexOptions.None, TimeSpan.FromMilliseconds(100)); - swaggerDoc.Paths.Remove(path.Key); - swaggerDoc.Paths.Add(newKey, path.Value); - } - } - } - } -} diff --git a/PxWeb/Filters/Api2/GeneratePathParamsValidationFilter.cs b/PxWeb/Filters/Api2/GeneratePathParamsValidationFilter.cs deleted file mode 100644 index 03daf37b..00000000 --- a/PxWeb/Filters/Api2/GeneratePathParamsValidationFilter.cs +++ /dev/null @@ -1,176 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.Linq; - -using Microsoft.AspNetCore.Mvc.Controllers; -using Microsoft.OpenApi.Models; - -using Swashbuckle.AspNetCore.SwaggerGen; - -namespace PxWeb.Filters.Api2 -{ - /// - /// Path Parameter Validation Rules Filter - /// - public class GeneratePathParamsValidationFilter : IOperationFilter - { - /// - /// Constructor - /// - /// Operation - /// OperationFilterContext - public void Apply(OpenApiOperation operation, OperationFilterContext context) - { - var pars = context.ApiDescription.ParameterDescriptions; - - foreach (var par in pars) - { - var openapiParam = operation.Parameters.SingleOrDefault(p => p.Name == par.Name); - - var attributes = ((ControllerParameterDescriptor)par.ParameterDescriptor).ParameterInfo.CustomAttributes.ToList(); - - // See https://github.com/domaindrivendev/Swashbuckle.AspNetCore/issues/1147 - // and https://mikeralphson.github.io/openapi/2017/03/15/openapi3.0.0-rc0 - // Basically OpenAPI v3 body parameters are split out into RequestBody and the properties have moved to schema - if (attributes.Any() && openapiParam != null) - { - // Required - [Required] - var requiredAttr = attributes.FirstOrDefault(p => p.AttributeType == typeof(RequiredAttribute)); - if (requiredAttr != null) - { - openapiParam.Required = true; - } - - // Regex Pattern [RegularExpression] - var regexAttr = attributes.FirstOrDefault(p => p.AttributeType == typeof(RegularExpressionAttribute)); - if (regexAttr != null) - { - var regex = (string?)regexAttr.ConstructorArguments[0].Value; - openapiParam.Schema.Pattern = regex; - } - - // String Length [StringLength] - int? minLength = null, maxLength = null; - var stringLengthAttr = attributes.FirstOrDefault(p => p.AttributeType == typeof(StringLengthAttribute)); - if (stringLengthAttr != null) - { - if (stringLengthAttr.NamedArguments.Count == 1) - { - minLength = (int?)stringLengthAttr.NamedArguments.Single(p => p.MemberName == "MinimumLength").TypedValue.Value; - } - maxLength = (int?)stringLengthAttr.ConstructorArguments[0].Value; - } - - var minLengthAttr = attributes.FirstOrDefault(p => p.AttributeType == typeof(MinLengthAttribute)); - if (minLengthAttr != null) - { - minLength = (int?)minLengthAttr.ConstructorArguments[0].Value; - } - - var maxLengthAttr = attributes.FirstOrDefault(p => p.AttributeType == typeof(MaxLengthAttribute)); - if (maxLengthAttr != null) - { - maxLength = (int?)maxLengthAttr.ConstructorArguments[0].Value; - } - - if (minLength != null) - { - openapiParam.Schema.MinLength = minLength; - } - - if (maxLength != null) - { - openapiParam.Schema.MaxLength = maxLength; - } - - // Range [Range] - var rangeAttr = attributes.FirstOrDefault(p => p.AttributeType == typeof(RangeAttribute)); - if (rangeAttr != null) - { - var rangeMin = (int?)rangeAttr.ConstructorArguments[0].Value; - var rangeMax = (int?)rangeAttr.ConstructorArguments[1].Value; - - openapiParam.Schema.MinLength = rangeMin; - openapiParam.Schema.MaxLength = rangeMax; - } - } - } - } - - //public void Apply(OpenApiOperation operation, OperationFilterContext context) - //{ - // var pars = context.ApiDescription.ParameterDescriptions; - - // foreach (var par in pars) - // { - // var swaggerParam = operation.Parameters.SingleOrDefault(p => p.Name == par.Name); - - // var attributes = ((ControllerParameterDescriptor)par.ParameterDescriptor).ParameterInfo.CustomAttributes; - - // if (attributes != null && attributes.Count() > 0 && swaggerParam != null) - // { - // // Required - [Required] - // var requiredAttr = attributes.FirstOrDefault(p => p.AttributeType == typeof(RequiredAttribute)); - // if (requiredAttr != null) - // { - // swaggerParam.Required = true; - // } - - // // Regex Pattern [RegularExpression] - // var regexAttr = attributes.FirstOrDefault(p => p.AttributeType == typeof(RegularExpressionAttribute)); - // if (regexAttr != null) - // { - // string regex = (string)regexAttr.ConstructorArguments[0].Value; - // if (swaggerParam is OpenApiParameter) - // { - // ((OpenApiParameter)swaggerParam).Schema.Pattern = regex; - // } - // } - - // // String Length [StringLength] - // int? minLenght = null, maxLength = null; - // var stringLengthAttr = attributes.FirstOrDefault(p => p.AttributeType == typeof(StringLengthAttribute)); - // if (stringLengthAttr != null) - // { - // if (stringLengthAttr.NamedArguments.Count == 1) - // { - // minLenght = (int)stringLengthAttr.NamedArguments.Single(p => p.MemberName == "MinimumLength").TypedValue.Value; - // } - // maxLength = (int)stringLengthAttr.ConstructorArguments[0].Value; - // } - - // var minLengthAttr = attributes.FirstOrDefault(p => p.AttributeType == typeof(MinLengthAttribute)); - // if (minLengthAttr != null) - // { - // minLenght = (int)minLengthAttr.ConstructorArguments[0].Value; - // } - - // var maxLengthAttr = attributes.FirstOrDefault(p => p.AttributeType == typeof(MaxLengthAttribute)); - // if (maxLengthAttr != null) - // { - // maxLength = (int)maxLengthAttr.ConstructorArguments[0].Value; - // } - - // if (swaggerParam is OpenApiParameter) - // { - // ((OpenApiParameter)swaggerParam).Schema.MinLength = minLenght; - // ((OpenApiParameter)swaggerParam).Schema.MaxLength = maxLength; - // } - - // // Range [Range] - // var rangeAttr = attributes.FirstOrDefault(p => p.AttributeType == typeof(RangeAttribute)); - // if (rangeAttr != null) - // { - // int rangeMin = (int)rangeAttr.ConstructorArguments[0].Value; - // int rangeMax = (int)rangeAttr.ConstructorArguments[1].Value; - - // if (swaggerParam is OpenApiParameter) - // { - // ((OpenApiParameter)swaggerParam).Schema.Minimum = rangeMin; - // ((OpenApiParameter)swaggerParam).Schema.Maximum = rangeMax; - // } - // } - // } - // } - //} - } -} diff --git a/PxWeb/PxWeb.csproj b/PxWeb/PxWeb.csproj index 19c973c5..2cce43bf 100644 --- a/PxWeb/PxWeb.csproj +++ b/PxWeb/PxWeb.csproj @@ -1,7 +1,7 @@ - net8.0 + net10.0 enable disabled false @@ -42,9 +42,7 @@ - - @@ -55,12 +53,8 @@ - - - - - - + + diff --git a/PxWebApi.BigTests/PxWebApi.BigTests.csproj b/PxWebApi.BigTests/PxWebApi.BigTests.csproj index bec09265..8ab27477 100644 --- a/PxWebApi.BigTests/PxWebApi.BigTests.csproj +++ b/PxWebApi.BigTests/PxWebApi.BigTests.csproj @@ -1,7 +1,7 @@ - net8.0 + net10.0 enable true false @@ -23,11 +23,11 @@ - + - - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/PxWebApi_Mvc.Tests/PxWebApi_Mvc.Tests.csproj b/PxWebApi_Mvc.Tests/PxWebApi_Mvc.Tests.csproj index 2d86263f..5dc7da8e 100644 --- a/PxWebApi_Mvc.Tests/PxWebApi_Mvc.Tests.csproj +++ b/PxWebApi_Mvc.Tests/PxWebApi_Mvc.Tests.csproj @@ -1,7 +1,7 @@  - net8.0 + net10.0 enable enable @@ -27,13 +27,16 @@ - - - - - - - + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + + + + diff --git a/global.json b/global.json index 391ba3c2..99b1511d 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "8.0.100", + "version": "10.0.202", "rollForward": "latestFeature" } }