I recently had a case where I needed to dig through a customer’s metadata to find the cause of a metadata error being thrown in their EDTs. In digging through the EDTs and the fields on tables using those EDTs I realized how easy it is to miss pieces when you are trying to upgrade code. For example, it is easy to forget to delete an EDT and not update the table using that EDT to point to a different EDT. As another example, it is easy to delete a field from a table and have a field group that has no fields left in it. All of this is metadata you would probably want to clean up if you knew about it.
With that in mind, I wrote the attached class which should help you find EDTs, table fields, table relations, and field groups that need to be reviewed. The class makes no changes to your metadata…to be clear it doesn’t fix anything. It only writes to the infolog to tell you what to go take a look at. As a warning, I know the class isn’t perfect. I only had so many hours to give it but you can use it if you like and it is easy to keep adding to if you like where it is going. To use the attached, import the xpo and it creates a class called MetadataValidator. Run the class and its main method will call the validation methods I’ve written.
Enjoy and happy upgrading!!