Skip to content

Scope down owned JSON deprecation to just collections with a synthetic key#38395

Open
Copilot wants to merge 5 commits into
mainfrom
copilot/deprecate-owned-types-with-ordinal-keys
Open

Scope down owned JSON deprecation to just collections with a synthetic key#38395
Copilot wants to merge 5 commits into
mainfrom
copilot/deprecate-owned-types-with-ordinal-keys

Conversation

Copilot AI commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

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:

  • Introduce RelationalEventId.OwnedEntityMappedToJsonCollectionWarning with logging resources and diagnostics plumbing, and emit it from RelationalModelValidator.
  • Suppress the new warning in shared/provider-specific relational fixtures which intentionally use OwnsMany(...).ToJson().
  • Remove EF8001 pragmas/suppressions and drop the ToJson() [Obsolete] diagnostic ID/message infrastructure that is no longer used.

Copilot AI and others added 3 commits June 9, 2026 23:01
… 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>
@AndriySvyryd AndriySvyryd requested a review from Copilot June 10, 2026 01:15
@AndriySvyryd AndriySvyryd changed the title Suppress OwnedEntityMappedToJsonCollectionWarning in remaining owned-collection test fixtures Scope down owned JSON deprecation to just collections with a synthetic key Jun 10, 2026

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

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.OwnedEntityMappedToJsonCollectionWarning with logging resources and diagnostics plumbing, and emit it from RelationalModelValidator.
  • Suppress the new warning in shared/provider-specific relational fixtures which intentionally use OwnsMany(...).ToJson().
  • Remove EF8001 pragmas/suppressions and drop the ToJson() [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

Comment thread src/EFCore.Relational/Properties/RelationalStrings.resx Outdated
@AndriySvyryd AndriySvyryd marked this pull request as ready for review June 10, 2026 01:26
@AndriySvyryd AndriySvyryd requested a review from a team as a code owner June 10, 2026 01:26
@AndriySvyryd AndriySvyryd requested a review from cincuranet June 10, 2026 01:27
…w key as alternative

Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
Comment thread src/EFCore.Relational/Properties/RelationalStrings.Designer.cs
…I baseline

Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot June 10, 2026 23:16
Copilot AI requested a review from AndriySvyryd June 10, 2026 23:16
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.

Consider (not) deprecating relational owned JSON support Deprecate owned types with ordinal keys (owned JSON collections)

3 participants