4.5 KiB
Unity is a complex and highly customizable engine, and in some cases, the validation suite will flag errors incorrectly. While the Package Manager Infrastructure team fixes these issues, a mechanism exists to temporarily get your package validated.
Current Conditions for using error exceptions:
- The Package Manager Infrastructure team has been notified about the failure.
- The Exception file is shipped with the package, for tracking purposes.
Steps to include a validation error exception:
- Create a file called "ValidationExceptions.json" at the root of your package.
- Make sure to generate the associated .meta file by opening the package in an editor.
- Include content as specified below under the
ErrorExceptions
array:- ValidationTest - Display Name of the test in which the exception is requested, as seen in the report generated byt he Validation Suite.
- ExceptionMessage - Full error string for which the exception is requested. Do not include the initial "Error: " string. New lines in the message can be represented in the JSON string using
\n
. - PackageVersion - Version of the package for which this exception is requested. This mechanism is to insight you to revisit exceptions on every version of the package, and find ways to remove them, by working through issues with the package infrastructure team.
ValidationExceptions.json file format
{
"ErrorExceptions":
[
{
"ValidationTest": "API Validation",
"ExceptionMessage": "Error without the words Error: at the begining",
"PackageVersion": "0.8.2-preview"
}
]
}
Test Level Exception
In some rare cases, due to the nature or number of errors in a given test, a complete test might need to be exceptioned.
To do so, simply remove the ExceptionMessage
field, and all errors found in the given test will be exceptioned.
{
"ErrorExceptions":
[
{
"ValidationTest": "API Validation",
"PackageVersion": "0.8.2-preview"
}
]
}
Warning Exceptions
In addition to error exceptions, warnings can also be exceptioned in case they are not relevant to avoid the Warnings validation result in the UI.
All validations accept warning exceptions. The format is equivalent to error exceptions except that they are listed under the WarningExceptions
array:
{
"WarningExceptions":
[
{
"ValidationTest": "Validation that produces a particular irrelevant warning",
"ExceptionMessage": "Warning without the words Warning: at the begining",
"PackageVersion": "0.8.2-preview"
},
{
"ValidationTest": "Validation that produces nothing but irrelevant warnings",
"PackageVersion": "0.8.2-preview"
}
]
}
Example:
if the Validation Suite report is:
Validation Suite Results for package "com.unity.my-package"
- Path: /path/to/com.unity.my-package
- Version: 4.5.6
- Context: LocalDevelopmentInternal
- Lifecycle: 1
- Test Time: 2020-05-22 9:25:22 AM
- Tested with com.unity.package-validation-suite version: 0.10.0-preview
VALIDATION RESULTS:
------------------
Failed - "API Validation"
Error: There was an error with the API Validation.
Failed - "Restricted File Type Validation"
Error: /csc.rsp cannot be included in a package.
Warning: /foo.js should not be included in packages unless absolutely necessary. Please confirm that its inclusion is deliberate and intentional.
Succeeded - "Assembly Definition Validation"
Succeeded - "ChangeLog Validation"
Succeeded - "Package Diff Evaluation"
[...]
and you would like to make an exception for a specific Restricted File Type Validation and for all of the API Validation errors in your package's version 4.5.6
, then the ValidationExceptions.json file would contain:
{
"ErrorExceptions":
[
{
"ValidationTest": "API Validation",
"PackageVersion": "4.5.6"
},
{
"ValidationTest": "Restricted File Type Validation",
"ExceptionMessage": "/csc.rsp cannot be included in a package.",
"PackageVersion": "4.5.6"
}
],
"WarningExceptions":
[
{
"ValidationTest": "Restricted File Type Validation",
"ExceptionMessage": "/foo.js should not be included in packages unless absolutely necessary. Please confirm that its inclusion is deliberate and intentional.",
"PackageVersion": "4.5.6"
}
]
}