Skip to content

Commit a4d21d3

Browse files
authored
[modelsrepository] Dependency update (System.Text.Encodings.Web) and error msg change. (Azure#25115)
* Covers dependency update and error msg change. * Adds comment explaining explicit reference.
1 parent 9bad6ad commit a4d21d3

File tree

57 files changed

+394
-388
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+394
-388
lines changed

sdk/modelsrepository/Azure.IoT.ModelsRepository/src/Azure.IoT.ModelsRepository.csproj

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<AssemblyTitle>Azure IoT Models Repository SDK</AssemblyTitle>
@@ -18,6 +18,10 @@
1818
<ItemGroup>
1919
<PackageReference Include="Azure.Core" />
2020
<PackageReference Include="System.Text.Json" />
21+
<!-- The explicit package reference is required to pull a version >4.6.0 which contains a vulnerability.
22+
Not versioning will use the version defined in eng/Packages.Data.props.
23+
System.Text.Encodings.Web is a dependency for System.Text.Json -->
24+
<PackageReference Include="System.Text.Encodings.Web" />
2125
</ItemGroup>
2226

2327
<!-- Common source from Azure.Core -->

sdk/modelsrepository/Azure.IoT.ModelsRepository/src/ModelsRepositoryEventSource.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ internal sealed class ModelsRepositoryEventSource : AzureEventSource
2525
private const int FailureProcessingRepositoryMetadataEventId = 3001;
2626
private const int InvalidDtmiInputEventId = 4000;
2727
private const int ErrorFetchingModelContentEventId = 4004;
28-
private const int IncorrectDtmiCasingEventId = 4006;
28+
private const int IncorrectDtmiEventId = 4006;
2929

3030
public static ModelsRepositoryEventSource Instance { get; } = new ModelsRepositoryEventSource();
3131

@@ -79,12 +79,12 @@ public void DiscoveredDependencies(string dependencies)
7979
}
8080
}
8181

82-
[Event(IncorrectDtmiCasingEventId, Level = EventLevel.Error, Message = StandardStrings.IncorrectDtmiCasing)]
83-
public void IncorrectDtmiCasing(string expected, string parsed)
82+
[Event(IncorrectDtmiEventId, Level = EventLevel.Error, Message = StandardStrings.IncorrectDtmi)]
83+
public void IncorrectDtmi(string expected, string parsed)
8484
{
8585
if (IsEnabled(EventLevel.Error, EventKeywords.None))
8686
{
87-
WriteEvent(IncorrectDtmiCasingEventId, expected, parsed);
87+
WriteEvent(IncorrectDtmiEventId, expected, parsed);
8888
}
8989
}
9090

sdk/modelsrepository/Azure.IoT.ModelsRepository/src/RepositoryHandler.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,10 @@ private async Task<ModelResult> ProcessAsync(
134134
string parsedDtmi = metadata.Id;
135135
if (!parsedDtmi.Equals(targetDtmi, StringComparison.Ordinal))
136136
{
137-
ModelsRepositoryEventSource.Instance.IncorrectDtmiCasing(targetDtmi, parsedDtmi);
137+
ModelsRepositoryEventSource.Instance.IncorrectDtmi(targetDtmi, parsedDtmi);
138138
string formatErrorMsg =
139139
$"{string.Format(CultureInfo.InvariantCulture, StandardStrings.GenericGetModelsError, targetDtmi)} " +
140-
string.Format(CultureInfo.InvariantCulture, StandardStrings.IncorrectDtmiCasing, targetDtmi, parsedDtmi);
140+
string.Format(CultureInfo.InvariantCulture, StandardStrings.IncorrectDtmi, targetDtmi, parsedDtmi);
141141

142142
throw new RequestFailedException(formatErrorMsg, new FormatException(formatErrorMsg));
143143
}

sdk/modelsrepository/Azure.IoT.ModelsRepository/src/StandardStrings.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ internal class StandardStrings
1414
public const string FetchingModelContent = "Attempting to fetch model content from \"{0}\".";
1515
public const string ErrorFetchingModelContent = "Model file \"{0}\" not found or not accessible in target repository.";
1616
public const string FailureProcessingRepositoryMetadata = "Unable to fetch or process repository metadata file.";
17-
public const string IncorrectDtmiCasing =
18-
"Fetched model has incorrect DTMI casing. Expected \"{0}\", parsed \"{1}\".";
17+
public const string IncorrectDtmi =
18+
"Fetched model has an incorrect DTMI. Expected \"{0}\", parsed \"{1}\".";
1919
}
2020
}

sdk/modelsrepository/Azure.IoT.ModelsRepository/tests/GetModelIntegrationTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public void GetModelWrongDtmiCasingThrowsException(ModelsRepositoryTestBase.Clie
2525
string expectedExMsg =
2626
string.Format(StandardStrings.GenericGetModelsError, "dtmi:com:example:thermostat;1") +
2727
" " +
28-
string.Format(StandardStrings.IncorrectDtmiCasing, "dtmi:com:example:thermostat;1", "dtmi:com:example:Thermostat;1");
28+
string.Format(StandardStrings.IncorrectDtmi, "dtmi:com:example:thermostat;1", "dtmi:com:example:Thermostat;1");
2929

3030
Func<Task> act = async () => await client.GetModelAsync(dtmi);
3131
act.Should().Throw<RequestFailedException>().WithMessage(expectedExMsg);

sdk/modelsrepository/Azure.IoT.ModelsRepository/tests/SessionRecords/GetModelIntegrationTests/GetModelDependenciesComponents(Local,False).json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/modelsrepository/Azure.IoT.ModelsRepository/tests/SessionRecords/GetModelIntegrationTests/GetModelDependenciesComponents(Local,False)Async.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/modelsrepository/Azure.IoT.ModelsRepository/tests/SessionRecords/GetModelIntegrationTests/GetModelDependenciesComponents(Local,True).json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/modelsrepository/Azure.IoT.ModelsRepository/tests/SessionRecords/GetModelIntegrationTests/GetModelDependenciesComponents(Local,True)Async.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/modelsrepository/Azure.IoT.ModelsRepository/tests/SessionRecords/GetModelIntegrationTests/GetModelDependenciesComponents(Remote,False).json

Lines changed: 40 additions & 40 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)