Skip to content

refactor: Upgrade code implementations (#73) (#74) - #75

Merged
norarrsgd merged 1 commit into
devfrom
prod
Sep 29, 2025
Merged

refactor: Upgrade code implementations (#73) (#74)#75
norarrsgd merged 1 commit into
devfrom
prod

Conversation

@norarrsgd

@norarrsgd norarrsgd commented Sep 29, 2025

Copy link
Copy Markdown
Owner
  • refactor: Upgrade code implementations

  • fix: Changes based on CodeRabbit review

  • test: Add tests for mapping empty collections in structs and models

  • refactor: Enable nullable reference types and improve null safety across the mapper library

  • chore: Update project metadata and properties in POCOMapper.csproj (v2.7.0)

  • chore: Remove outdated contributors section and installation instructions from README.md

  • refactor: Improve type safety and element type resolution in collection mapping logic

  • refactor: Enhance enum and nullable enum mapping with expanded type safety and string support

  • refactor: Add validation for non-enumerable source properties in collection mapping logic


Summary by CodeRabbit

  • New Features

    • Nullable-aware mapping APIs and improved collection mapping.
    • New generic mapper interface for bidirectional mapping.
    • Enhanced extensibility via a top-level mapping base type and extensions.
  • Bug Fixes

    • Corrected STRING_LIST property naming inconsistency.
  • Documentation

    • Updated package metadata and release notes link.
    • Simplified README content.
  • Tests

    • Reorganized test models and namespaces for clarity.
  • Chores

    • Version bumped to 2.7.0; license changed to MIT.
    • Upgraded build/test tooling (frameworks, runners, CI setup).

* refactor: Upgrade code implementations

* fix: Changes based on CodeRabbit review

* test: Add tests for mapping empty collections in structs and models

* refactor: Enable nullable reference types and improve null safety across the mapper library

* chore: Update project metadata and properties in POCOMapper.csproj (v2.7.0)

* chore: Remove outdated contributors section and installation instructions from README.md

* refactor: Improve type safety and element type resolution in collection mapping logic

* refactor: Enhance enum and nullable enum mapping with expanded type safety and string support

* refactor: Add validation for non-enumerable source properties in collection mapping logic

---------

Co-authored-by: nor arrsgd <norgelera@duck.com>
@norarrsgd
norarrsgd merged commit 85aba5c into dev Sep 29, 2025
3 of 4 checks passed
@coderabbitai

coderabbitai Bot commented Sep 29, 2025

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

Walkthrough

Promotes many previously nested/internal test models and helpers to top-level public types under POCOMapper.Test.Models, updates mappings (notably STRIN_LIST → STRING_LIST), upgrades SDK/CI targets (.NET 9 in workflow, net8.0 tests), updates packaging metadata/versioning, adopts file-scoped namespaces, introduces ModelMapperCore, and makes mapper/extension APIs nullable-aware.

Changes

Cohort / File(s) Summary
CI workflow update
.github/workflows/nuget-publish.yml
Updates setup-dotnet to use dotnet-version 9.x instead of 6.x.
Test data generation refactor
POCOMapper.Test/DataGenerator.cs
Moves CommonModel, DataGenerator, and ValueGenerator to top-level (public/static) with same logic; adjusts visibilities.
Test class restructuring
POCOMapper.Test/MapperTest.cs
Converts to file-scoped namespace; introduces top-level public MapperTest with existing tests relocated from nested structure.
Test models promoted and reorganized
POCOMapper.Test/Models/* including:
MultiMapModels.cs
SourceModel.cs
SourceRecord.cs
SourceStruct.cs
SourceWithIgnore.cs
StringMapModels.cs
TargetModel.cs
TargetRecord.cs
TargetStruct.cs
TargetWithIgnore.cs
Moves many types from internal/nested under POCOMapper.Test to public top-level under POCOMapper.Test.Models. Fixes name typos: STRIN_LISTSTRING_LIST. Extracts formerly nested Inner* types to top-level. Formatting/attribute placement normalized.
Test project configuration
POCOMapper.Test/POCOMapper.Test.csproj
Targets net8.0; C# 12; updates Microsoft.NET.Test.Sdk and xunit.runner.visualstudio versions.
Test internals visibility
POCOMapper.Test/Properties/AssemblyInfo.cs
Adds InternalsVisibleTo("POCOMapper.Benchmarks").
License change
POCOMapper/LICENSE
Replaces GPLv3 with MIT License text.
Library packaging/metadata upgrade
POCOMapper/POCOMapper.csproj
Bumps version to 2.7.0; adds assembly/file versions, nullable enabled, C# 12, package metadata, includes LICENSE in package, adds XML docs.
Attributes namespace style
POCOMapper/attributes.cs
Switches to file-scoped namespace; keeps public attribute APIs unchanged.
Core mapper introduction
POCOMapper/core.cs
Adds internal ModelMapperCore; Map signature becomes nullable: object? Map(object? toConvert, Type? targetType).
Exception scope change
POCOMapper/exception.cs
Promotes IMapperException to top-level public class under file-scoped namespace; constructors unchanged.
Extensions and ModelMap refactor
POCOMapper/extension.cs
Moves ModelMap to top-level public abstract class (IDisposable) in POCO.Mapper.Extension; updates extension methods to return nullable types and nullable element collections.
Public mapper API overhaul
POCOMapper/mapper.cs
Introduces public interface IMapper<T,S> and class ModelMapper<T,S> using ModelMapperCore; methods now use nullable returns and inputs; list mapping optimized.
Docs cleanup
README.md
Removes contributor/setup sections; no code changes.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Client
  participant Mapper as ModelMapper<T,S>
  participant Core as ModelMapperCore
  note over Client,Mapper: Mapping a single object (nullable-aware)

  Client->>Mapper: From(S? source)
  alt source is null
    Mapper-->>Client: null
  else source not null
    Mapper->>Core: Map(source, typeof(T))
    Core-->>Mapper: object? (T or null)
    Mapper-->>Client: T?
  end
Loading
sequenceDiagram
  autonumber
  actor Client
  participant Ext as POCOMapperExtensions
  participant MapModel as ModelMap
  participant Core as ModelMapperCore
  note over Client,Ext: Extension-based mapping flow

  Client->>Ext: MapTo<T>(this ModelMap)
  Ext->>Core: Map(ModelMap, typeof(T))
  Core-->>Ext: object? (T or null)
  Ext-->>Client: T?
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested labels

enhancement

Poem

A whisker-twitch, a version hop,
I map my fields from tip to top.
New cores hum softly, nulls allowed,
Models step out—public, proud.
MIT skies, a cleaner night—
Thump-thump! I ship in 2.7 light. 🐇✨

✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch prod

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c33d3d4 and f3c6633.

⛔ Files ignored due to path filters (1)
  • .DS_Store is excluded by !**/.DS_Store
📒 Files selected for processing (23)
  • .github/workflows/nuget-publish.yml (1 hunks)
  • POCOMapper.Test/DataGenerator.cs (1 hunks)
  • POCOMapper.Test/MapperTest.cs (1 hunks)
  • POCOMapper.Test/Models/MultiMapModels.cs (1 hunks)
  • POCOMapper.Test/Models/SourceModel.cs (1 hunks)
  • POCOMapper.Test/Models/SourceRecord.cs (1 hunks)
  • POCOMapper.Test/Models/SourceStruct.cs (1 hunks)
  • POCOMapper.Test/Models/SourceWithIgnore.cs (1 hunks)
  • POCOMapper.Test/Models/StringMapModels.cs (1 hunks)
  • POCOMapper.Test/Models/TargetModel.cs (1 hunks)
  • POCOMapper.Test/Models/TargetRecord.cs (1 hunks)
  • POCOMapper.Test/Models/TargetStruct.cs (1 hunks)
  • POCOMapper.Test/Models/TargetWithIgnore.cs (1 hunks)
  • POCOMapper.Test/POCOMapper.Test.csproj (1 hunks)
  • POCOMapper.Test/Properties/AssemblyInfo.cs (1 hunks)
  • POCOMapper/LICENSE (1 hunks)
  • POCOMapper/POCOMapper.csproj (1 hunks)
  • POCOMapper/attributes.cs (1 hunks)
  • POCOMapper/core.cs (1 hunks)
  • POCOMapper/exception.cs (1 hunks)
  • POCOMapper/extension.cs (1 hunks)
  • POCOMapper/mapper.cs (1 hunks)
  • README.md (0 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant