Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
a29f84c
Remove .NET Framework 4.8.1 tests
RobertoSalinas Jun 13, 2025
e93abfd
Remove .NET Framework 4.8.1 tests
RobertoSalinas Jun 13, 2025
8762309
Merge branch 'master' of https://github.com/pipoburgos/MicroElements.…
RobertoSalinas Jun 13, 2025
44840d2
Merge branch 'master' of https://github.com/pipoburgos/MicroElements.…
RobertoSalinas Jun 13, 2025
36eedc9
Merge branch 'master' of https://github.com/pipoburgos/MicroElements.…
RobertoSalinas Jun 13, 2025
d6f4d78
Merge branch 'master' of https://github.com/pipoburgos/MicroElements.…
RobertoSalinas Jun 13, 2025
30f9bf9
Merge branch 'master' of https://github.com/pipoburgos/MicroElements.…
RobertoSalinas Jun 13, 2025
95ea6f2
Merge branch 'master' of https://github.com/pipoburgos/MicroElements.…
RobertoSalinas Jun 13, 2025
20f357c
Merge branch 'master' of https://github.com/pipoburgos/MicroElements.…
RobertoSalinas Jun 13, 2025
edd06d9
Merge branch 'master' of https://github.com/pipoburgos/MicroElements.…
RobertoSalinas Jun 13, 2025
51b3366
Merge branch 'master' of https://github.com/pipoburgos/MicroElements.…
RobertoSalinas Jun 13, 2025
1d7c4f2
Merge branch 'master' of https://github.com/pipoburgos/MicroElements.…
RobertoSalinas Jun 13, 2025
4863bb4
Merge branch 'master' of https://github.com/pipoburgos/MicroElements.…
RobertoSalinas Jun 13, 2025
79bd544
Merge branch 'master' of https://github.com/pipoburgos/MicroElements.…
RobertoSalinas Jun 13, 2025
2e60bd3
Merge branch 'master' of https://github.com/pipoburgos/MicroElements.…
RobertoSalinas Jun 13, 2025
02eabda
Merge branch 'master' of https://github.com/pipoburgos/MicroElements.…
RobertoSalinas Jun 13, 2025
e799925
Merge branch 'master' of https://github.com/pipoburgos/MicroElements.…
RobertoSalinas Jun 13, 2025
eba3ad4
Update github_build_and_publish.yml
avgalex Nov 25, 2024
9d6d10f
Update github_build_and_publish.yml
avgalex Nov 25, 2024
adc51eb
Ensure we do not throw when some types can't be loaded
thomhurst Oct 6, 2024
19cd23c
Fix duplicate regular expression patterns in a generated schema
Feb 27, 2025
d931597
Add looking for properties through AllOf, AnyOf, OneOf
Feb 27, 2025
643b28b
Migrate project to .NET 8 and 9 with dynamic versions and multi-targe…
RobertoSalinas Jun 12, 2025
73bf3a6
Remove .NET Framework 4.8.1 tests
RobertoSalinas Jun 13, 2025
d18d99e
Remove .NET Framework 4.8.1 tests
RobertoSalinas Jun 13, 2025
55eb51c
Merge
RobertoSalinas Jun 13, 2025
aad86a3
Merge branch 'micro-elements:master' into master
pipoburgos Jun 13, 2025
b08d6c2
Fix
RobertoSalinas Jun 13, 2025
3c5fb3b
Merge branch 'master' of https://github.com/pipoburgos/MicroElements.…
RobertoSalinas Jun 13, 2025
ca481b0
Change github action
RobertoSalinas Jun 13, 2025
e458af4
Change github workflow.
RobertoSalinas Jun 16, 2025
388fca2
update-packages
RobertoSalinas Jul 9, 2025
dc9ce98
Fix Multiple arguments with the same name (ForceUploadPackages)update…
RobertoSalinas Jul 9, 2025
1af6140
Merge branch 'master' of https://github.com/pipoburgos/MicroElements.…
RobertoSalinas Jul 9, 2025
0fd6675
Comment UseScopedSwagger
RobertoSalinas Jul 9, 2025
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
15 changes: 12 additions & 3 deletions .github/workflows/github_build_and_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ on:

jobs:
build:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-latest, windows-latest]

steps:
# Шаг 1: Клонируем репозиторий
Expand All @@ -23,13 +27,18 @@ jobs:
8.0.x
9.0.x

- name: Build Windows
if: runner.os == 'Windows'
run: |
./build.ps1 --target=Travis --verbosity=normal --ForceUploadPackages=false
shell: powershell

# Шаг 3: Сборка проекта
- name: Build
if: runner.os == 'Linux'
env:
UPLOAD_NUGET: ${{ secrets.UPLOAD_NUGET }}
UPLOAD_NUGET_API_KEY: ${{ secrets.UPLOAD_NUGET_API_KEY }}
run: |
chmod a+x ./build.sh
./build.sh --target=Travis --verbosity=normal --ForceUploadPackages=true


29 changes: 24 additions & 5 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// IMPORTS
///////////////////////////////////////////////////////////////////////////////

#load tools/microelements.devops/1.9.1/scripts/imports.cake
#load tools/microelements.devops/1.11.0/scripts/imports.cake

///////////////////////////////////////////////////////////////////////////////
// SCRIPT ARGS AND CONVENTIONS
Expand All @@ -21,9 +21,28 @@ ScriptArgs args = new ScriptArgs(Context)
Task("Build")
.Does(() => args.Build().BuildSamples());

Task("Test")
.WithCriteria(()=>args.RunTests)
.Does(() => RunTests(args));
var isWindows = Environment.Platform.Family == PlatformFamily.Windows;
Task("Tests")
.Does(() =>
{
var solution = "MicroElements.Swashbuckle.FluentValidation.sln";

if (isWindows)
{
Information("Executing tests net481, net8.0, net9.0 on Windows");

DotNetTest(solution, new DotNetTestSettings { Framework = "net481" });
DotNetTest(solution, new DotNetTestSettings { Framework = "net8.0" });
DotNetTest(solution, new DotNetTestSettings { Framework = "net9.0" });
}
else
{
Information("Executing tests net8.0 y net9.0 on Linux/macOS");

DotNetTest(solution, new DotNetTestSettings { Framework = "net8.0" });
DotNetTest(solution, new DotNetTestSettings { Framework = "net9.0" });
}
});

Task("UploadTestResultsToAppVeyor")
.WithCriteria(()=>args.RunTests)
Expand Down Expand Up @@ -68,4 +87,4 @@ Task("AppVeyor")
.IsDependentOn("UploadTestResultsToAppVeyor")
;

RunTarget(args.Target);
RunTarget(args.Target);
3 changes: 2 additions & 1 deletion build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ if(!$PSScriptRoot){
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
}

$CAKE_VERSION = "0.38.0"
$CAKE_VERSION = "1.3.0"
$DEVOPS_VERSION = "1.11.0"
$NUGET_URL = "https://api.nuget.org/v3/index.json"
$NUGET_BETA_URL = "https://www.myget.org/F/micro-elements/api/v3/index.json"
Expand Down Expand Up @@ -63,6 +63,7 @@ if ($Verbosity) { $cakeArguments += "-verbosity=$Verbosity" }
$cakeArguments += ("--rootDir="+@("$PSScriptRoot"));
$cakeArguments += ("--devOpsVersion=$DEVOPS_VERSION");
$cakeArguments += ("--devOpsRoot=""$TOOLS_DIR/microelements.devops/$DEVOPS_VERSION""");
$cakeArguments += ("--ForceUploadPackages=false")
$cakeArguments += $ScriptArgs

# Start Cake
Expand Down
6 changes: 4 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@ TOOLS_DIR=$SCRIPT_DIR/tools
SCRIPT=$TOOLS_DIR/microelements.devops/$DEVOPS_VERSION/scripts/main.cake

CAKE_PROPS_PATH=$TOOLS_DIR/cake.props
CAKE_VERSION="0.38.0"
CAKE_VERSION="1.3.0"
CAKE_ARGUMENTS=()

# Parse arguments.
for i in "$@"; do
case $1 in
-s|--script) SCRIPT="$2"; shift ;;
--cake-version) CAKE_VERSION="--version=$2"; shift ;;
--ForceUploadPackages=*|--ForceUploadPackages) ;;
--) shift; CAKE_ARGUMENTS+=("$@"); break ;;
*) CAKE_ARGUMENTS+=("$1") ;;
esac
Expand All @@ -35,6 +36,7 @@ done
CAKE_ARGUMENTS+=("--rootDir=$SCRIPT_DIR");
CAKE_ARGUMENTS+=("--devOpsVersion=$DEVOPS_VERSION");
CAKE_ARGUMENTS+=("--devOpsRoot=$TOOLS_DIR/microelements.devops/$DEVOPS_VERSION");
CAKE_ARGUMENTS+=("--ForceUploadPackages=false")

echo "===========VARIABLES============"
echo "SCRIPT_DIR: $SCRIPT_DIR"
Expand Down Expand Up @@ -80,4 +82,4 @@ dotnet tool restore
echo "Running build script..."
CMD="dotnet cake $SCRIPT ${CAKE_ARGUMENTS[@]}"
echo $CMD
exec $CMD
exec $CMD
4 changes: 2 additions & 2 deletions samples/MinimalApi/MinimalApi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

<ItemGroup>
<PackageReference Include="FluentValidation.AspNetCore" Version="11.3.1" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.6" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="8.1.4" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.*-*" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="9.0.3" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion samples/SampleNSwagWebApi/SampleNSwagWebApi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<ItemGroup>
<PackageReference Include="FluentValidation.AspNetCore" Version="11.3.1" />
<PackageReference Include="JetBrains.Annotations" Version="2024.3.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="9.0.6" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="9.0.*-*" />
<PackageReference Include="NSwag.AspNetCore" Version="14.4.0" />
</ItemGroup>

Expand Down
4 changes: 2 additions & 2 deletions samples/SampleWebApi/SampleWebApi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="9.0.*-*" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="9.0.*-*" />
<PackageReference Include="NJsonSchema" Version="11.3.2" />
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="8.1.4" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="8.1.4" />
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="9.0.3" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="9.0.3" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
</ItemGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<Import Project="..\common.props" />

<ItemGroup>
<PackageReference Include="MicroElements.IsExternalInit" Version="1.1.0" PrivateAssets="all" />
<PackageReference Include="NJsonSchema" Version="11.3.2" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
<PackageReference Include="MicroElements.CodeContracts.Sources" Version="1.4.0" PrivateAssets="all" />
<PackageReference Include="MicroElements.IsExternalInit" Version="1.1.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.3.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.6" />
<PackageReference Include="Microsoft.Extensions.Options" Version="9.0.6" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.*-*" />
<PackageReference Include="Microsoft.Extensions.Options" Version="9.0.*-*" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
<Import Project="..\common.props" />

<ItemGroup>
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="[6.3.0, 9)" />
<PackageReference Include="MicroElements.IsExternalInit" Version="1.1.0" PrivateAssets="all" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="8.1.*-*" Condition="'$(TargetFramework)' == 'netstandard2.0'"/>
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="9.0.*-*" Condition="'$(TargetFramework)' == 'net8.0' or '$(TargetFramework)' == 'net9.0'"/>
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,51 +1,51 @@
// Copyright (c) MicroElements. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//// Copyright (c) MicroElements. All rights reserved.
//// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Swashbuckle.AspNetCore.Swagger;
//using Microsoft.AspNetCore.Builder;
//using Microsoft.AspNetCore.Http;
//using Swashbuckle.AspNetCore.Swagger;
//using System;
//using System.Threading.Tasks;

namespace MicroElements.Swashbuckle.FluentValidation
{
/// <summary>
/// SwaggerMiddleware that resolves <see cref="ISwaggerProvider"/> on scope.
/// Resolves problems with validators with dependency on scoped services.
/// </summary>
public class ScopedSwaggerMiddleware
{
private readonly RequestDelegate _next;
private readonly SwaggerOptions _options;
//namespace MicroElements.Swashbuckle.FluentValidation
//{
// /// <summary>
// /// SwaggerMiddleware that resolves <see cref="ISwaggerProvider"/> on scope.
// /// Resolves problems with validators with dependency on scoped services.
// /// </summary>
// public class ScopedSwaggerMiddleware
// {
// private readonly RequestDelegate _next;
// private readonly SwaggerOptions _options;

/// <summary>
/// ctor.
/// </summary>
/// <param name="next"></param>
/// <param name="options"></param>
public ScopedSwaggerMiddleware(RequestDelegate next, SwaggerOptions options)
{
_next = next;
_options = options;
}
// /// <summary>
// /// ctor.
// /// </summary>
// /// <param name="next"></param>
// /// <param name="options"></param>
// public ScopedSwaggerMiddleware(RequestDelegate next, SwaggerOptions options)
// {
// _next = next;
// _options = options;
// }

public async Task Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
{
await new SwaggerMiddleware(_next, _options).Invoke(httpContext, swaggerProvider);
}
}
// public async Task Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
// {
// await new SwaggerMiddleware(_next, _options).Invoke(httpContext, swaggerProvider);
// }
// }

public static class SwaggerBuilderExtensions
{
/// <summary>
/// Replaces standard <see cref="SwaggerMiddleware"/> with <see cref="ScopedSwaggerMiddleware"/>.
/// Use instead of <see cref="SwaggerBuilderExtensions.UseSwagger"/> if you have services with scoped services like DbContext.
/// </summary>
public static IApplicationBuilder UseScopedSwagger(this IApplicationBuilder app, Action<SwaggerOptions> setupAction = null)
{
SwaggerOptions swaggerOptions = new SwaggerOptions();
setupAction?.Invoke(swaggerOptions);
return app.UseMiddleware<ScopedSwaggerMiddleware>(swaggerOptions);
}
}
}
// public static class SwaggerBuilderExtensions
// {
// /// <summary>
// /// Replaces standard <see cref="SwaggerMiddleware"/> with <see cref="ScopedSwaggerMiddleware"/>.
// /// Use instead of <see cref="SwaggerBuilderExtensions.UseSwagger"/> if you have services with scoped services like DbContext.
// /// </summary>
// public static IApplicationBuilder UseScopedSwagger(this IApplicationBuilder app, Action<SwaggerOptions> setupAction = null)
// {
// SwaggerOptions swaggerOptions = new SwaggerOptions();
// setupAction?.Invoke(swaggerOptions);
// return app.UseMiddleware<ScopedSwaggerMiddleware>(swaggerOptions);
// }
// }
//}
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net481;net8.0;net9.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="8.3.0" />
<PackageReference Include="FluentAssertions" Version="8.4.0" />
<PackageReference Include="FluentValidation.AspNetCore" Version="11.3.1" Condition="'$(TargetFramework)' == 'net8.0' or '$(TargetFramework)' == 'net9.0'" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="8.1.4" />
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="9.0.3" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.1" PrivateAssets="all" />
</ItemGroup>
Expand Down
Loading