Skip to content

Do not apply regular attributes to elements - #204

Merged
viceroypenguin merged 2 commits into
masterfrom
icollection-elements
Aug 2, 2025
Merged

viceroypenguin merged 2 commits into
masterfrom
icollection-elements

Conversation

@viceroypenguin

Copy link
Copy Markdown
Member

Fixes #201

@codecov

codecov Bot commented Aug 2, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.43750% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...alidations.Generators/ValidateTargetTransformer.cs 98.43% 1 Missing ⚠️
Files with missing lines Coverage Δ
...alidations.Generators/ValidateTargetTransformer.cs 94.80% <98.43%> (+0.32%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@viceroypenguin
viceroypenguin requested a review from Copilot August 2, 2025 00:33

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes the application of validation attributes to elements within collections, ensuring attributes are only applied to the appropriate targets (collections vs. collection elements).

Key changes:

  • Modifies validation generation logic to distinguish between collection-level and element-level attributes
  • Adds tests for new collection validation scenarios
  • Updates test infrastructure to suppress compiler warnings for invalid attribute placement

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
ValidateTargetTransformer.cs Core logic changes to properly handle attribute application based on target type (collection vs element)
GeneratorTestHelper.cs Suppresses CS0658 compiler warning for invalid attribute locations
CollectionTests.cs Adds new test cases for List and string[] with NotEmpty validation
Various test snapshots Updated expected outputs reflecting corrected validation logic
CollectionTests integration test Updates test expectations to match new validation behavior

Comment thread src/Immediate.Validations.Generators/ValidateTargetTransformer.cs
@viceroypenguin
viceroypenguin enabled auto-merge (squash) August 2, 2025 00:37
@viceroypenguin
viceroypenguin merged commit 29927ef into master Aug 2, 2025
@viceroypenguin
viceroypenguin deleted the icollection-elements branch August 2, 2025 00:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Generator: Do not apply regular attributes to elements

2 participants