Scope down owned JSON deprecation to just collections with a synthetic key#38395
Open
Copilot wants to merge 5 commits into
Open
Scope down owned JSON deprecation to just collections with a synthetic key#38395Copilot wants to merge 5 commits into
Copilot wants to merge 5 commits into
Conversation
… tests Instead of deprecating all relational owned JSON support (#37290), only owned types with ordinal keys should be deprecated (#37289). This removes the unnecessary broad Obsolete attributes and all related test suppressions. Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
…ss in JSON tests Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
…collection test fixtures Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
AndriySvyryd
June 10, 2026 01:15
View session
There was a problem hiding this comment.
Pull request overview
Adds a new relational model-validation warning for owned JSON collections (obsolete scenario) and updates remaining relational/functional fixtures and tests to suppress that warning where it is expected, unblocking broad provider test runs. The PR also removes the prior EF8001 “owned JSON obsolete” compile-time diagnostic infrastructure and associated test suppressions.
Changes:
- Introduce
RelationalEventId.OwnedEntityMappedToJsonCollectionWarningwith logging resources and diagnostics plumbing, and emit it fromRelationalModelValidator. - Suppress the new warning in shared/provider-specific relational fixtures which intentionally use
OwnsMany(...).ToJson(). - Remove
EF8001pragmas/suppressions and drop theToJson()[Obsolete]diagnostic ID/message infrastructure that is no longer used.
Reviewed changes
Copilot reviewed 41 out of 42 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/EFCore.Tests/Infrastructure/ModelValidatorTest.cs | Remove EF8001 pragma usage in JSON-owned tests. |
| test/EFCore.SqlServer.Tests/Migrations/SqlServerModelDifferTest.cs | Remove EF8001 pragma usage around JSON owned-type migration tests. |
| test/EFCore.SqlServer.Tests/Infrastructure/SqlServerModelValidatorTest.cs | Remove EF8001 pragma usage around JSON-owned validation test. |
| test/EFCore.SqlServer.FunctionalTests/Update/JsonUpdateJsonTypeSqlServerFixture.cs | Remove top-level EF8001 pragma; fixture still configures JSON owned mappings. |
| test/EFCore.SqlServer.FunctionalTests/Query/JsonQueryJsonTypeSqlServerFixture.cs | Remove top-level EF8001 pragma; fixture still configures JSON owned mappings. |
| test/EFCore.SqlServer.FunctionalTests/Query/AdHocMiscellaneousQuerySqlServerTest.cs | Ignore new owned-JSON-collection warning for non-shared SQL Server test contexts; remove EF8001 pragmas. |
| test/EFCore.SqlServer.FunctionalTests/Query/AdHocJsonQuerySqlServerTestBase.cs | Remove top-level EF8001 pragma in SQL Server ad-hoc JSON query base. |
| test/EFCore.SqlServer.FunctionalTests/ModelBuilding/SqlServerModelBuilderTestBase.cs | Remove EF8001 pragmas around JSON model-building tests. |
| test/EFCore.SqlServer.FunctionalTests/MaterializationInterceptionSqlServerTest.cs | Ignore new owned-JSON-collection warning for interception tests using JSON owned collections. |
| test/EFCore.Sqlite.FunctionalTests/MaterializationInterceptionSqliteTest.cs | Ignore new owned-JSON-collection warning for interception tests using JSON owned collections. |
| test/EFCore.Specification.Tests/TestUtilities/BuildSource.cs | Remove suppression of EF8001 from test compilation options. |
| test/EFCore.Specification.Tests/Query/AdHocJsonQueryTestBase.cs | Ensure warning configuration is applied when creating non-shared JSON contexts in specific tests. |
| test/EFCore.Relational.Tests/Migrations/Internal/MigrationsModelDifferTest.cs | Remove EF8001 pragmas around JSON migration differ tests. |
| test/EFCore.Relational.Tests/Metadata/RelationalModelTest.cs | Ignore new owned-JSON-collection warning in convention-based model builder used by tests. |
| test/EFCore.Relational.Tests/Metadata/Conventions/TableSharingConcurrencyTokenConventionTest.cs | Remove EF8001 pragmas around JSON-mapped entity convention tests. |
| test/EFCore.Relational.Tests/Infrastructure/RelationalModelValidatorTest.Json.cs | Remove top-level EF8001 pragma in relational model validator JSON tests. |
| test/EFCore.Relational.Specification.Tests/Update/JsonUpdateFixtureBase.cs | Ignore new owned-JSON-collection warning at fixture options level. |
| test/EFCore.Relational.Specification.Tests/Scaffolding/CompiledModelRelationalTestBase.cs | Ignore new owned-JSON-collection warning for compiled-model big model scenarios using JSON owned collections. |
| test/EFCore.Relational.Specification.Tests/Query/Translations/JsonTranslationsRelationalTestBase.cs | Remove EF8001 pragmas around ToJson usage in translation tests. |
| test/EFCore.Relational.Specification.Tests/Query/PrimitiveCollectionsQueryRelationalTestBase.cs | Remove EF8001 pragmas around JSON-owned primitive collection test. |
| test/EFCore.Relational.Specification.Tests/Query/PrecompiledQueryRelationalTestBase.cs | Remove EF8001 pragmas around JSON-owned collection mapping in precompiled context. |
| test/EFCore.Relational.Specification.Tests/Query/PrecompiledQueryRelationalFixture.cs | Ignore new owned-JSON-collection warning at fixture options level. |
| test/EFCore.Relational.Specification.Tests/Query/OptionalDependentQueryFixtureBase.cs | Remove EF8001 pragmas around ToJson usage in optional-dependent fixture. |
| test/EFCore.Relational.Specification.Tests/Query/OperatorsQueryTestBase.cs | Remove EF8001 pragmas around JSON scalar/operator test. |
| test/EFCore.Relational.Specification.Tests/Query/JsonQueryRelationalFixture.cs | Ignore new owned-JSON-collection warning at fixture options level; remove EF8001 pragma. |
| test/EFCore.Relational.Specification.Tests/Query/Associations/OwnedJson/OwnedJsonRelationalFixtureBase.cs | Ignore new owned-JSON-collection warning at fixture options level; remove EF8001 pragma. |
| test/EFCore.Relational.Specification.Tests/Query/AdHocPrecompiledQueryRelationalTestBase.cs | Remove EF8001 pragmas around ad-hoc precompiled JSON context. |
| test/EFCore.Relational.Specification.Tests/Query/AdHocJsonQueryRelationalTestBase.cs | Override warning configuration to ignore new owned-JSON-collection warning for relational ad-hoc JSON tests. |
| test/EFCore.Relational.Specification.Tests/PropertyValuesRelationalTestBase.cs | Remove top-level EF8001 pragma; model uses complex collection mapped to JSON. |
| test/EFCore.Relational.Specification.Tests/ModelBuilding/RelationalTestModelBuilderExtensions.cs | Remove [Obsolete(...DiagnosticId=EF8001)] from test ToJson helpers. |
| test/EFCore.Relational.Specification.Tests/Migrations/MigrationsTestBase.cs | Remove EF8001 pragmas around JSON migration tests. |
| test/EFCore.Relational.Specification.Tests/ComplexTypesTrackingRelationalTestBase.cs | Remove EF8001 pragmas around JSON-related model building. |
| test/EFCore.Design.Tests/Migrations/Design/CSharpMigrationsGeneratorTest.ModelSnapshot.cs | Remove EF8001 pragmas around snapshot tests for JSON owned types. |
| src/Shared/EFDiagnostics.cs | Remove the EF8001 diagnostic ID/message constants. |
| src/EFCore.Relational/Properties/RelationalStrings.resx | Add user-facing log message resource for owned JSON collection obsolete warning. |
| src/EFCore.Relational/Properties/RelationalStrings.Designer.cs | Add generated accessors for the new warning resource/event definition. |
| src/EFCore.Relational/Infrastructure/RelationalModelValidator.cs | Emit the new warning when detecting JSON-mapped owned collections (ordinal key). |
| src/EFCore.Relational/Extensions/RelationalOwnedNavigationBuilderExtensions.cs | Remove ToJson() [Obsolete(..., DiagnosticId = EF8001)] annotations. |
| src/EFCore.Relational/EFCore.Relational.baseline.json | Update API baseline to include the new event ID and logger extension. |
| src/EFCore.Relational/Diagnostics/RelationalLoggingDefinitions.cs | Add logging definition slot for the new warning. |
| src/EFCore.Relational/Diagnostics/RelationalLoggerExtensions.cs | Add logger extension to dispatch the new warning + event data. |
| src/EFCore.Relational/Diagnostics/RelationalEventId.cs | Define OwnedEntityMappedToJsonCollectionWarning event ID and documentation. |
Files not reviewed (1)
- src/EFCore.Relational/Properties/RelationalStrings.Designer.cs: Language not supported
AndriySvyryd
approved these changes
Jun 10, 2026
…w key as alternative Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
…I baseline Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #37289
Fixes #37290
Adds a new relational model-validation warning for owned JSON collections (obsolete scenario) and updates remaining relational/functional fixtures and tests to suppress that warning where it is expected, unblocking broad provider test runs. The PR also removes the prior
EF8001“owned JSON obsolete” compile-time diagnostic infrastructure and associated test suppressions.Changes:
RelationalEventId.OwnedEntityMappedToJsonCollectionWarningwith logging resources and diagnostics plumbing, and emit it fromRelationalModelValidator.OwnsMany(...).ToJson().EF8001pragmas/suppressions and drop theToJson()[Obsolete]diagnostic ID/message infrastructure that is no longer used.