You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Relax property validation for ApplicationPackage JSON
Commented out the exception for missing properties in ApplicationPackage JSON validation due to the TargetPlatform property being omitted for packages marked for deletion. Now, only extra properties will trigger an exception, allowing processing to continue when required properties are missing for deletable packages. Also, always validates JSON structure regardless of fileStatus.
// TargetPlatform property disappears from all packages once we mark the oldest package for deletion!
131
+
// So commenting this check because it would just always throw and wouldn't let us continue.
132
+
130
133
// Throw exceptions if there are discrepancies, shouldn't continue.
131
-
if(missingProperties.Count>0)
132
-
{
133
-
thrownewInvalidOperationException($"Missing required properties in ApplicationPackage JSON: {string.Join(", ",missingProperties)}");
134
-
}
134
+
// if (missingProperties.Count > 0)
135
+
// {
136
+
// throw new InvalidOperationException($"Missing required properties in ApplicationPackage JSON: {string.Join(", ", missingProperties)}");
137
+
// }
135
138
139
+
// Throwing on extra properties is good to keep because that means we need to update the JSON class for source-generated (de)serialization.
136
140
if(extraProperties.Count>0)
137
141
{
138
142
thrownewInvalidOperationException($"Unexpected extra properties in ApplicationPackage JSON: {string.Join(", ",extraProperties)}. This may indicate new features have been added to the API that are not supported by this version of the code.");
139
143
}
140
144
}
141
145
142
146
/// <summary>
143
-
/// Validates an ApplicationPackage.
147
+
/// An ApplicationPackage from JsonElement with validation.
144
148
/// </summary>
145
-
/// <param name="jsonElement"></param>
146
-
/// <returns>An ApplicationPackage from JsonElement with validation.</returns>
// else: Skip validation intentionally for PendingDelete packages to avoid false failures when the API omits properties (e.g., targetPlatform) for those entries.
162
-
// We don't need to validate them anyway since we're getting rid of them.
0 commit comments