-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Initial Commit - Bring ModelRepository Project to the mono repo #18706
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
b61754f
Initial Commit - Bring ModelRepository Project to the mono repo
azabbasi 3f112ac
Update ResolverClientOptions.cs
azabbasi 5f917dc
CR comments.
azabbasi 434c014
Add ci and test yaml files and add changelog
azabbasi 4afb86b
More CR comments
azabbasi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| launchSettings.json | ||
37 changes: 37 additions & 0 deletions
37
sdk/modelsrepository/Azure.Iot.ModelsRepository/Azure.Iot.ModelsRepository.sln
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| | ||
| Microsoft Visual Studio Solution File, Format Version 12.00 | ||
| # Visual Studio Version 16 | ||
| VisualStudioVersion = 16.0.30717.126 | ||
| MinimumVisualStudioVersion = 10.0.40219.1 | ||
| Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Iot.ModelsRepository", "src\Azure.Iot.ModelsRepository.csproj", "{5E11A377-0D20-49F8-952B-50390196EF4B}" | ||
| EndProject | ||
| Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Iot.ModelsRepository.Tests", "tests\Azure.Iot.ModelsRepository.Tests.csproj", "{092E6CE2-9998-428C-A801-2BAB4E14A577}" | ||
| EndProject | ||
| Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Core.TestFramework", "..\..\core\Azure.Core.TestFramework\src\Azure.Core.TestFramework.csproj", "{1FC8A3EA-3C0D-4DDF-B710-A7091F2CEBB1}" | ||
| EndProject | ||
| Global | ||
| GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
| Debug|Any CPU = Debug|Any CPU | ||
| Release|Any CPU = Release|Any CPU | ||
| EndGlobalSection | ||
| GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
| {5E11A377-0D20-49F8-952B-50390196EF4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
| {5E11A377-0D20-49F8-952B-50390196EF4B}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
| {5E11A377-0D20-49F8-952B-50390196EF4B}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
| {5E11A377-0D20-49F8-952B-50390196EF4B}.Release|Any CPU.Build.0 = Release|Any CPU | ||
| {092E6CE2-9998-428C-A801-2BAB4E14A577}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
| {092E6CE2-9998-428C-A801-2BAB4E14A577}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
| {092E6CE2-9998-428C-A801-2BAB4E14A577}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
| {092E6CE2-9998-428C-A801-2BAB4E14A577}.Release|Any CPU.Build.0 = Release|Any CPU | ||
| {1FC8A3EA-3C0D-4DDF-B710-A7091F2CEBB1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
| {1FC8A3EA-3C0D-4DDF-B710-A7091F2CEBB1}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
| {1FC8A3EA-3C0D-4DDF-B710-A7091F2CEBB1}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
| {1FC8A3EA-3C0D-4DDF-B710-A7091F2CEBB1}.Release|Any CPU.Build.0 = Release|Any CPU | ||
| EndGlobalSection | ||
| GlobalSection(SolutionProperties) = preSolution | ||
| HideSolutionNode = FALSE | ||
| EndGlobalSection | ||
| GlobalSection(ExtensibilityGlobals) = postSolution | ||
| SolutionGuid = {671D1EFB-2BB9-4846-91EF-A3FB1FF9DDA6} | ||
| EndGlobalSection | ||
| EndGlobal |
19 changes: 19 additions & 0 deletions
19
sdk/modelsrepository/Azure.Iot.ModelsRepository/CHANGELOG.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # Release History | ||
|
|
||
| ## 1.0.0-preview.1 (Unreleased) | ||
|
|
||
| ### New features | ||
|
|
||
| - Initial preview of Azure.IoT.ModelRepository SDK | ||
|
|
||
| ### Breaking changes | ||
|
|
||
| - N/A | ||
|
|
||
| ### Added | ||
|
|
||
| - N/A | ||
|
|
||
| ### Fixes and improvements | ||
|
|
||
| - N/A |
41 changes: 41 additions & 0 deletions
41
sdk/modelsrepository/Azure.Iot.ModelsRepository/CodeMaid.config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <configuration> | ||
| <configSections> | ||
| <sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | ||
| <section name="SteveCadwallader.CodeMaid.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> | ||
| </sectionGroup> | ||
| </configSections> | ||
| <userSettings> | ||
| <SteveCadwallader.CodeMaid.Properties.Settings> | ||
| <setting name="Cleaning_AutoCleanupOnFileSave" serializeAs="String"> | ||
| <value>True</value> | ||
| </setting> | ||
| <setting name="Formatting_CommentXmlSpaceSingleTags" serializeAs="String"> | ||
| <value>True</value> | ||
| </setting> | ||
| <setting name="Cleaning_InsertEndOfFileTrailingNewLine" serializeAs="String"> | ||
| <value>True</value> | ||
| </setting> | ||
| <setting name="Formatting_CommentWrapColumn" serializeAs="String"> | ||
| <value>120</value> | ||
| </setting> | ||
| <setting name="Formatting_CommentRunDuringCleanup" serializeAs="String"> | ||
| <value>False</value> | ||
| </setting> | ||
| <setting name="Cleaning_UpdateFileHeaderCSharp" serializeAs="String"> | ||
| <value>// Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
| </value> | ||
| </setting> | ||
| <setting name="Reorganizing_PrimaryOrderByAccessLevel" serializeAs="String"> | ||
| <value>True</value> | ||
| </setting> | ||
| <setting name="Cleaning_PerformPartialCleanupOnExternal" serializeAs="String"> | ||
| <value>1</value> | ||
| </setting> | ||
| <setting name="Progressing_ShowBuildProgressOnBuildStart" serializeAs="String"> | ||
| <value>False</value> | ||
| </setting> | ||
| </SteveCadwallader.CodeMaid.Properties.Settings> | ||
| </userSettings> | ||
| </configuration> |
6 changes: 6 additions & 0 deletions
6
sdk/modelsrepository/Azure.Iot.ModelsRepository/Directory.Build.props
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| <Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
| <!-- | ||
| Add any shared properties you want for the projects under this package directory that need to be set before the auto imported Directory.Build.props | ||
| --> | ||
| <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory).., Directory.Build.props))\Directory.Build.props" /> | ||
| </Project> |
23 changes: 23 additions & 0 deletions
23
sdk/modelsrepository/Azure.Iot.ModelsRepository/src/Azure.Iot.ModelsRepository.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
|
|
||
| <PropertyGroup> | ||
| <AssemblyTitle>Azure IoT Models Repository SDK</AssemblyTitle> | ||
| <TargetFrameworks>$(RequiredTargetFrameworks)</TargetFrameworks> | ||
|
|
||
| <AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
| </PropertyGroup> | ||
|
|
||
| <!-- Nuget properties --> | ||
| <PropertyGroup> | ||
| <PackageTags>IoT;ModelsRepository;Pnp;DigitalTwins$(PackageCommonTags)</PackageTags> | ||
| <Description>SDK for the Azure IoT Models Repository</Description> | ||
| <Version>1.0.0-preview.1</Version> | ||
| </PropertyGroup> | ||
|
|
||
|
|
||
| <ItemGroup> | ||
| <PackageReference Include="System.Text.Json" /> | ||
| </ItemGroup> | ||
|
|
||
| <Import Project="$(RepoRoot)\sdk\core\Azure.Core\src\Azure.Core.props" /> | ||
| </Project> |
32 changes: 32 additions & 0 deletions
32
sdk/modelsrepository/Azure.Iot.ModelsRepository/src/DtmiConventions.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using System; | ||
| using System.Globalization; | ||
| using System.Text.RegularExpressions; | ||
|
|
||
| namespace Azure.Iot.ModelsRepository | ||
| { | ||
| internal static class DtmiConventions | ||
| { | ||
| public static bool IsDtmi(string dtmi) => !string.IsNullOrEmpty(dtmi) && new Regex(@"^dtmi:[A-Za-z](?:[A-Za-z0-9_]*[A-Za-z0-9])?(?::[A-Za-z](?:[A-Za-z0-9_]*[A-Za-z0-9])?)*;[1-9][0-9]{0,8}$").IsMatch(dtmi); | ||
azabbasi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| public static string DtmiToPath(string dtmi) => IsDtmi(dtmi) ? $"{dtmi.ToLowerInvariant().Replace(":", "/").Replace(";", "-")}.json" : null; | ||
|
|
||
| public static string DtmiToQualifiedPath(string dtmi, string basePath, bool fromExpanded = false) | ||
| { | ||
| string dtmiPath = DtmiToPath(dtmi); | ||
azabbasi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| if (dtmiPath == null) | ||
azabbasi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, StandardStrings.InvalidDtmiFormat, dtmi)); | ||
|
|
||
| if (!basePath.EndsWith("/", StringComparison.InvariantCultureIgnoreCase)) | ||
| basePath += "/"; | ||
|
|
||
| string fullyQualifiedPath = $"{basePath}{dtmiPath}"; | ||
|
|
||
| if (fromExpanded) | ||
| fullyQualifiedPath = fullyQualifiedPath.Replace(".json", ".expanded.json"); | ||
|
|
||
| return fullyQualifiedPath; | ||
| } | ||
| } | ||
| } | ||
12 changes: 12 additions & 0 deletions
12
sdk/modelsrepository/Azure.Iot.ModelsRepository/src/Fetchers/FetchResult.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| namespace Azure.Iot.ModelsRepository.Fetchers | ||
| { | ||
| internal class FetchResult | ||
| { | ||
| public string Definition { get; set; } | ||
| public string Path { get; set; } | ||
| public bool FromExpanded => Path.EndsWith("expanded.json", System.StringComparison.InvariantCultureIgnoreCase); | ||
| } | ||
| } |
16 changes: 16 additions & 0 deletions
16
sdk/modelsrepository/Azure.Iot.ModelsRepository/src/Fetchers/IModelFetcher.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using System; | ||
| using System.Threading; | ||
| using System.Threading.Tasks; | ||
|
|
||
| namespace Azure.Iot.ModelsRepository.Fetchers | ||
| { | ||
| internal interface IModelFetcher | ||
| { | ||
| Task<FetchResult> FetchAsync(string dtmi, Uri repositoryUri, CancellationToken cancellationToken = default); | ||
|
|
||
| FetchResult Fetch(string dtmi, Uri repositoryUri, CancellationToken cancellationToken = default); | ||
| } | ||
| } |
65 changes: 65 additions & 0 deletions
65
sdk/modelsrepository/Azure.Iot.ModelsRepository/src/Fetchers/LocalModelFetcher.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using System; | ||
| using System.IO; | ||
| using System.Threading.Tasks; | ||
| using System.Text; | ||
| using System.Collections.Generic; | ||
| using System.Threading; | ||
| using System.Globalization; | ||
|
|
||
| namespace Azure.Iot.ModelsRepository.Fetchers | ||
| { | ||
| internal class LocalModelFetcher : IModelFetcher | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. marked this and the RemoteModelFetcher as internal |
||
| { | ||
| private readonly bool _tryExpanded; | ||
|
|
||
| public LocalModelFetcher(ResolverClientOptions clientOptions) | ||
| { | ||
| _tryExpanded = clientOptions.DependencyResolution == DependencyResolutionOption.TryFromExpanded; | ||
azabbasi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| public Task<FetchResult> FetchAsync(string dtmi, Uri repositoryUri, CancellationToken cancellationToken = default) | ||
| { | ||
| return Task.FromResult(Fetch(dtmi, repositoryUri, cancellationToken)); | ||
| } | ||
|
|
||
| public FetchResult Fetch(string dtmi, Uri repositoryUri, CancellationToken cancellationToken = default) | ||
| { | ||
| var work = new Queue<string>(); | ||
|
|
||
| if (_tryExpanded) | ||
| work.Enqueue(GetPath(dtmi, repositoryUri, true)); | ||
|
|
||
| work.Enqueue(GetPath(dtmi, repositoryUri, false)); | ||
|
|
||
| string fnfError = string.Empty; | ||
| while (work.Count != 0 && !cancellationToken.IsCancellationRequested) | ||
| { | ||
| string tryContentPath = work.Dequeue(); | ||
| ResolverEventSource.Shared.FetchingModelContent(tryContentPath); | ||
|
|
||
| if (File.Exists(tryContentPath)) | ||
| { | ||
| return new FetchResult() | ||
| { | ||
| Definition = File.ReadAllText(tryContentPath, Encoding.UTF8), | ||
| Path = tryContentPath | ||
| }; | ||
| } | ||
|
|
||
| ResolverEventSource.Shared.ErrorFetchingModelContent(tryContentPath); | ||
| fnfError = string.Format(CultureInfo.InvariantCulture, StandardStrings.ErrorFetchingModelContent, tryContentPath); | ||
| } | ||
|
|
||
| throw new FileNotFoundException(fnfError); | ||
| } | ||
|
|
||
| private static string GetPath(string dtmi, Uri repositoryUri, bool expanded = false) | ||
| { | ||
| string registryPath = repositoryUri.AbsolutePath; | ||
| return DtmiConventions.DtmiToQualifiedPath(dtmi, registryPath, expanded); | ||
| } | ||
| } | ||
| } | ||
101 changes: 101 additions & 0 deletions
101
sdk/modelsrepository/Azure.Iot.ModelsRepository/src/Fetchers/RemoteModelFetcher.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using Azure.Core; | ||
| using Azure.Core.Pipeline; | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Globalization; | ||
| using System.IO; | ||
| using System.Text.Json; | ||
| using System.Threading; | ||
| using System.Threading.Tasks; | ||
|
|
||
| namespace Azure.Iot.ModelsRepository.Fetchers | ||
| { | ||
| internal class RemoteModelFetcher : IModelFetcher | ||
| { | ||
| private readonly HttpPipeline _pipeline; | ||
| private readonly bool _tryExpanded; | ||
|
|
||
| public RemoteModelFetcher(ResolverClientOptions clientOptions) | ||
| { | ||
| _pipeline = CreatePipeline(clientOptions); | ||
| _tryExpanded = clientOptions.DependencyResolution == DependencyResolutionOption.TryFromExpanded; | ||
| } | ||
|
|
||
| public FetchResult Fetch(string dtmi, Uri repositoryUri, CancellationToken cancellationToken = default) | ||
| { | ||
| throw new NotImplementedException(); | ||
| } | ||
|
|
||
| public async Task<FetchResult> FetchAsync(string dtmi, Uri repositoryUri, CancellationToken cancellationToken = default) | ||
| { | ||
| Queue<string> work = new Queue<string>(); | ||
|
|
||
| if (_tryExpanded) | ||
| work.Enqueue(GetPath(dtmi, repositoryUri, true)); | ||
|
|
||
| work.Enqueue(GetPath(dtmi, repositoryUri, false)); | ||
|
|
||
| string remoteFetchError = string.Empty; | ||
| while (work.Count != 0 && !cancellationToken.IsCancellationRequested) | ||
| { | ||
| string tryContentPath = work.Dequeue(); | ||
| ResolverEventSource.Shared.FetchingModelContent(tryContentPath); | ||
|
|
||
| string content = await EvaluatePathAsync(tryContentPath, cancellationToken).ConfigureAwait(false); | ||
| if (!string.IsNullOrEmpty(content)) | ||
| { | ||
| return new FetchResult() | ||
| { | ||
| Definition = content, | ||
| Path = tryContentPath | ||
| }; | ||
| } | ||
|
|
||
| ResolverEventSource.Shared.ErrorFetchingModelContent(tryContentPath); | ||
| remoteFetchError = string.Format(CultureInfo.InvariantCulture, StandardStrings.ErrorFetchingModelContent, tryContentPath); | ||
| } | ||
|
|
||
| throw new RequestFailedException(remoteFetchError); | ||
| } | ||
|
|
||
| private static string GetPath(string dtmi, Uri repositoryUri, bool expanded = false) | ||
| { | ||
| string absoluteUri = repositoryUri.AbsoluteUri; | ||
| return DtmiConventions.DtmiToQualifiedPath(dtmi, absoluteUri, expanded); | ||
| } | ||
|
|
||
| private async Task<string> EvaluatePathAsync(string path, CancellationToken cancellationToken) | ||
| { | ||
| Request request = _pipeline.CreateRequest(); | ||
| request.Method = RequestMethod.Get; | ||
| request.Uri = new RequestUriBuilder(); | ||
| request.Uri.Reset(new Uri(path)); | ||
|
|
||
| Response response = await _pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false); | ||
|
|
||
| if (response.Status >= 200 && response.Status <= 299) | ||
| { | ||
| return await GetContentAsync(response.ContentStream, cancellationToken).ConfigureAwait(false); | ||
| } | ||
|
|
||
| return null; | ||
azabbasi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| private static async Task<string> GetContentAsync(Stream content, CancellationToken cancellationToken) | ||
| { | ||
| using (JsonDocument json = await JsonDocument.ParseAsync(content, default, cancellationToken).ConfigureAwait(false)) | ||
| { | ||
| JsonElement root = json.RootElement; | ||
| return root.GetRawText(); | ||
| } | ||
| } | ||
|
|
||
| private static HttpPipeline CreatePipeline(ResolverClientOptions options) | ||
| { | ||
| return HttpPipelineBuilder.Build(options); | ||
| } | ||
| } | ||
| } | ||
23 changes: 23 additions & 0 deletions
23
sdk/modelsrepository/Azure.Iot.ModelsRepository/src/ModelMetadata.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using System.Collections.Generic; | ||
| using System.Linq; | ||
|
|
||
| namespace Azure.Iot.ModelsRepository | ||
| { | ||
| internal class ModelMetadata | ||
| { | ||
| public ModelMetadata(string id, IList<string> extends, IList<string> componentSchemas) | ||
| { | ||
| Id = id; | ||
| Extends = extends; | ||
| ComponentSchemas = componentSchemas; | ||
| } | ||
|
|
||
| public string Id { get; } | ||
| public IList<string> Extends { get; } | ||
| public IList<string> ComponentSchemas { get; } | ||
| public IList<string> Dependencies => Extends.Union(ComponentSchemas).ToList(); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.