Skip to content
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

V9.0.0/depedency bump #3

Merged
merged 4 commits into from
Oct 4, 2024
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
7 changes: 7 additions & 0 deletions Codebelt.Extensions.Newtonsoft.Json.sln
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Codebelt.Extensions.Newtons
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Codebelt.Extensions.AspNetCore.Mvc.Formatters.Newtonsoft.Json.Tests", "test\Codebelt.Extensions.AspNetCore.Mvc.Formatters.Newtonsoft.Json.Tests\Codebelt.Extensions.AspNetCore.Mvc.Formatters.Newtonsoft.Json.Tests.csproj", "{1CE82D1C-FEC6-4F25-A0FF-94E137F750AF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Codebelt.Extensions.AspNetCore.Newtonsoft.Json.Tests", "test\Codebelt.Extensions.AspNetCore.Newtonsoft.Json.Tests\Codebelt.Extensions.AspNetCore.Newtonsoft.Json.Tests.csproj", "{BF6A82F1-93DD-4022-9B20-DF83C3FE3C1B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -49,6 +51,10 @@ Global
{1CE82D1C-FEC6-4F25-A0FF-94E137F750AF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1CE82D1C-FEC6-4F25-A0FF-94E137F750AF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1CE82D1C-FEC6-4F25-A0FF-94E137F750AF}.Release|Any CPU.Build.0 = Release|Any CPU
{BF6A82F1-93DD-4022-9B20-DF83C3FE3C1B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BF6A82F1-93DD-4022-9B20-DF83C3FE3C1B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BF6A82F1-93DD-4022-9B20-DF83C3FE3C1B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BF6A82F1-93DD-4022-9B20-DF83C3FE3C1B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -60,6 +66,7 @@ Global
{260BDF91-E7C7-4CB4-A39D-E1A5374C5602} = {0070E83B-2DDD-4537-A83F-1CF8644F2880}
{90DB61D1-5538-49A4-9F8F-E2F67C1EEED0} = {A3C56B2E-55EE-44EC-876E-B03B8DDA3317}
{1CE82D1C-FEC6-4F25-A0FF-94E137F750AF} = {A3C56B2E-55EE-44EC-876E-B03B8DDA3317}
{BF6A82F1-93DD-4022-9B20-DF83C3FE3C1B} = {A3C56B2E-55EE-44EC-876E-B03B8DDA3317}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0CBE2805-F0FF-4D0F-902C-8B9277A5D3F2}
Expand Down
6 changes: 3 additions & 3 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@

<ItemGroup Condition="'$(IsTestProject)' == 'true'">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="xunit" Version="2.9.0" />
<PackageReference Include="xunit.runner.console" Version="2.9.0" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.runner.console" Version="2.9.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2" />
<PackageReference Include="coverlet.msbuild" Version="6.0.2">
<PrivateAssets>all</PrivateAssets>
Expand All @@ -81,7 +81,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Codebelt.Extensions.Xunit.App" Version="9.0.0-preview.2" />
<PackageReference Include="Codebelt.Extensions.Xunit.App" Version="9.0.0-preview.8" PrivateAssets="all" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

<Target Name="ApplyFileVersion" AfterTargets="MinVer">
<PropertyGroup>
<BUILD_BUILDNUMBER Condition="'$(BUILD_BUILDNUMBER)' == ''">00000</BUILD_BUILDNUMBER>
<FileVersion>$(MinVerMajor).$(MinVerMinor).$(MinVerPatch).$(BUILD_BUILDNUMBER)</FileVersion>
<GITHUB_RUN_NUMBER Condition="'$(GITHUB_RUN_NUMBER)' == ''">0</GITHUB_RUN_NUMBER>
<FileVersion>$(MinVerMajor).$(MinVerMinor).$(MinVerPatch).$(GITHUB_RUN_NUMBER)</FileVersion>
</PropertyGroup>
</Target>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</PropertyGroup>

<PropertyGroup>
<Description>The Cuemon.Extensions.AspNetCore.Mvc.Formatters.Newtonsoft.Json namespace contains both types and extension methods that complements both the Cuemon.Extensions.Newtonsoft.Json/Cuemon.Extensions.AspNetCore.Newtonsoft.Json namespace while being an addition to the Microsoft.AspNetCore.Mvc namespace. Provides JSON formatters for ASP.NET Core MVC that is powered by Newtonsoft.Json.</Description>
<Description>The Codebelt.Extensions.AspNetCore.Mvc.Formatters.Newtonsoft.Json namespace contains both types and extension methods that complements both the Codebelt.Extensions.Newtonsoft.Json/Codebelt.Extensions.AspNetCore.Newtonsoft.Json namespace while being an addition to the Microsoft.AspNetCore.Mvc namespace. Provides JSON formatters for ASP.NET Core MVC that is powered by Newtonsoft.Json.</Description>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Residual 'Cuemon' references found in project files.

Several project files still reference "Cuemon" outside of expected PackageReference contexts:

  • test/Codebelt.Extensions.AspNetCore.Newtonsoft.Json.Tests/Codebelt.Extensions.AspNetCore.Newtonsoft.Json.Tests.csproj:
    <PackageReference Include="Cuemon.Extensions.AspNetCore.Authentication" Version="9.0.0-preview.9" />

  • src/Codebelt.Extensions.AspNetCore.Newtonsoft.Json/Codebelt.Extensions.AspNetCore.Newtonsoft.Json.csproj:
    <PackageReference Include="Cuemon.Core" Version="9.0.0-preview.9" />
    <PackageReference Include="Cuemon.IO" Version="9.0.0-preview.9" />
    <Description>...complements the Cuemon.Extensions.AspNetCore/Cuemon.Extensions.Newtonsoft.Json namespace...</Description>

Please update these references to "Codebelt" to ensure complete namespace restructuring.

🔗 Analysis chain

Namespace update in Description looks good.

The change from "Cuemon" to "Codebelt" in the namespace references is consistent with the PR objectives. This appears to be part of a larger rebranding or restructuring effort.

Let's verify if there are any remaining occurrences of "Cuemon" in the project files that might need updating:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for any remaining "Cuemon" occurrences in project files
# Expect: No occurrences of "Cuemon" in project files, except for PackageReferences

rg --type xml "Cuemon" --glob "*.csproj" -C 2

Length of output: 5164

<PackageTags>extension-methods extensions json-converters add-json-serialization-formatters add-json-formatter-options</PackageTags>
</PropertyGroup>

Expand All @@ -23,8 +23,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Cuemon.AspNetCore.Mvc" Version="9.0.0-preview.7" />
<PackageReference Include="Cuemon.Extensions.IO" Version="9.0.0-preview.7" />
<PackageReference Include="Cuemon.AspNetCore.Mvc" Version="9.0.0-preview.9" />
<PackageReference Include="Cuemon.Extensions.IO" Version="9.0.0-preview.9" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Cuemon.Extensions.AspNetCore" Version="9.0.0-preview.7" />
<PackageReference Include="Cuemon.Extensions.AspNetCore" Version="9.0.0-preview.9" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Cuemon.Core" Version="9.0.0-preview.7" />
<PackageReference Include="Cuemon.IO" Version="9.0.0-preview.7" />
<PackageReference Include="Cuemon.Core" Version="9.0.0-preview.9" />
<PackageReference Include="Cuemon.IO" Version="9.0.0-preview.9" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using System.ComponentModel.DataAnnotations;

namespace Codebelt.Extensions.AspNetCore.Mvc.Formatters.Newtonsoft.Json.Assets
{
public class SampleModel
{
[Required(ErrorMessage = "This field is required.")]
[StringLength(100)]
public string Name { get; set; }
}
}
Comment on lines +5 to +11
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Consider enhancing the model for improved testability.

While the current implementation is sufficient for basic testing, consider the following enhancements to improve the model's usability in tests:

  1. Add a parameterless constructor and a constructor that sets the Name property.
  2. Override the ToString() method for easier debugging and logging.

Here's an example of how you could implement these suggestions:

public class SampleModel
{
    [Required(ErrorMessage = "This field is required.")]
    [StringLength(100, ErrorMessage = "The name cannot exceed 100 characters.")]
    public string Name { get; set; }

    public SampleModel() { }

    public SampleModel(string name)
    {
        Name = name;
    }

    public override string ToString()
    {
        return $"SampleModel {{ Name = {Name} }}";
    }
}

These additions would make the model more versatile for various testing scenarios.

Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
using System;
using System.Reflection;
using Cuemon.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace Codebelt.Extensions.AspNetCore.Mvc.Formatters.Newtonsoft.Json.Assets
{
[ApiController]
[Route("[controller]")]
public class StatusCodesController : ControllerBase
{
[HttpGet("400")]
public IActionResult Get_400()
{
throw new BadRequestException(new ArgumentNullException());
}

[HttpGet("401")]
public IActionResult Get_401()
{
throw new UnauthorizedException(new AccessViolationException());
}

[HttpGet("403")]
public IActionResult Get_403()
{
throw new ForbiddenException(new UnauthorizedAccessException());
}

[HttpGet("404")]
public IActionResult Get_404()
{
throw new NotFoundException(new NullReferenceException());
}

[HttpGet("405")]
public IActionResult Get_405()
{
throw new MethodNotAllowedException(new ArgumentException());
}

[HttpGet("406")]
public IActionResult Get_406()
{
throw new NotAcceptableException(new ArgumentException());
}

[HttpGet("409")]
public IActionResult Get_409()
{
throw new ConflictException(new AmbiguousMatchException());
}

[HttpGet("410")]
public IActionResult Get_410()
{
throw new GoneException(new NotImplementedException());
}

[HttpGet("412")]
public IActionResult Get_412()
{
throw new PreconditionFailedException(new ArgumentOutOfRangeException());
}

[HttpGet("413")]
public IActionResult Get_413()
{
throw new PayloadTooLargeException(new ArgumentOutOfRangeException());
}

[HttpGet("415")]
public IActionResult Get_415()
{
throw new UnsupportedMediaTypeException(new ArgumentOutOfRangeException());
}

[HttpGet("428")]
public IActionResult Get_428()
{
throw new PreconditionRequiredException(new ArgumentException());
}

[HttpGet("429")]
public IActionResult Get_429()
{
throw new TooManyRequestsException(new OverflowException());
}

[HttpGet("XXX/{app}")]
public IActionResult Get_XXX(string app)
{
try
{
throw new ArgumentException("This is an inner exception message ...", nameof(app))
{
Data =
{
{ nameof(app), app }
},
HelpLink = "https://www.savvyio.net/"
};
}
catch (Exception e)
{
throw new NotSupportedException("Main exception - look out for inner!", e);
}
}

[HttpPost("/")]
public IActionResult Post(SampleModel model)
{
return Ok(model);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
<RootNamespace>Codebelt.Extensions.AspNetCore.Mvc.Formatters.Newtonsoft.Json</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Cuemon.Extensions.AspNetCore.Mvc" Version="9.0.0-preview.9" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Codebelt.Extensions.AspNetCore.Mvc.Formatters.Newtonsoft.Json\Codebelt.Extensions.AspNetCore.Mvc.Formatters.Newtonsoft.Json.csproj" />
</ItemGroup>
Expand Down
Loading
Loading