stride3d / stride3d/stride

Add validation/warning for DataContractMetadataTypeAttribute

Open
#647 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area-Asset area-GameStudio enhancement
Dominant language
C#
Stars
7.8k
Forks
1.2k
Avg merge
2d 17h
Merged PRs (30d)
49

Description

Is your feature request related to a problem? Please describe.

Output a warning (at build time, or runtime in debug mode) if any properties in the metadata class of DataContractMetadataTypeAttribute doesn't exist in the actual data contract class (or its base class(es)).
This may occur when the user (or the codebase) has changed a field/property (either the name or the data type).

Describe the solution you'd like

The game should validate and warn the developer if a field/property on the metadata class no longer exists/matches on the control.
When validating the metadata's fields/properties, it should traverse the class inheritance (starting with the class it's declared on then search the base classes if not found), checking for the name & data type as a pair.
The validation should check both fields and properties. There is no constraint on matching if it's a field type or a property type (ie. a field on a metadata class can match with a property in the data contract class).

Additional context

Refer to #643 for the initial implementation specifically in this area for the current rules for matching the metadata's fields/properties:
https://github.com/stride3d/xenko/blob/9c8138288b40d43b2dfd9f99caefb63b99b2feda/sources/core/Xenko.Core.Reflection/TypeDescriptors/ObjectDescriptor.cs#L202-L232

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the matching rules in sources/core/Xenko.Core.Reflection/TypeDescriptors/ObjectDescriptor.cs at the referenced lines, then trace how DataContractMetadataTypeAttribute metadata is processed. Define completion as warnings for unmatched name-and-type pairs across fields and properties, including inherited members, without requiring field/property kinds to match.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.