Skip to content

Resolvers

Ricardo Minguez (Rido) edited this page Feb 25, 2021 · 9 revisions

Resolution is the process of getting all required interfaces associated to a given dtmi.

Models available in the Model Repo can be resolved by Model Resolver Client (s) using a signature similar like:

IDictionary<dtmi,dtdlJson> dtdlInterfaces = resolver('dtmi:com:example:TemperatureController;1')

The resolver is responsible for:

  1. Allow to configure different Model Repositories (federation)
  2. If none is configured , it will use the Public Device Model Repository by default
  3. Convert the DTMI to a relative path, as described in the Resolution-Convention
  4. All interface dependencies, from extends and @Component will be retrieved from
    1. A .expanded.json file with all the dependencies already flattened in an array
    2. The first element in the array MUST be the root interface
    3. Calculating the dependencies using the expand algorithm in the client
  5. Allow to acquire the interfaces ahead of time (before parsing)
  6. Allow to configure the DTDL parser to resolve on demand

Calculate Dependencies

DTDL v2 allows to reference external interfaces in extends and @Component:

  • There is only one level of nested @Component
  • extends can have multiple levels and can contain components.

The DMR client can resolve dependencies with two options

  • From the extended.json file (dependencies already pre-calculated)
  • From the client, making one call per interface and composing the resulting Array

Federation

The DMR client can work with a configurable registry, this value can point to a local folder or a url.

For the MVP release we dont need to resolve from multiple repos at the same time, the feature will be enabled in a feature release.

TBD. Handle repositories with authentication.

Error Handling

The client will throw exceptions in the next cases:

  1. The configured host (by FQDN) is not accessible
  2. The request path returns a 500 HTTP status code. (200, 300, and 400 ranges should be expected)
  3. Retrieved incorrect JSON document without the required DTDL fields: @id, extends, contents

When the resolver can't find ALL the required interfaces, it will return an EMPTY array without raising any exception.

Libraries, CLI, Samples

The DMR Client SDK will be available as a package (NuGet, NPM, Maven, PyPi) with a library to be consumed by any application using the targeted language.

Internal versions are available in the ADO feed: https://dev.azure.com/azure-iot-pnp/azure-iot-pnp-libraries

Additionally, we will provide a CLI that makes use of the Parser - with the resolver configured - to enable CLI validation.

The Validation-Pipeline will use the CLI to validate the submitted models are DTDL compliant.

Samples

We will provide samples to showcase how to interact with the DMR

Naming

The libraries, namespaces and libraries will use the next prefixes:

  • [TBD] Azure.DeviceModelRepo.Client
  • [TBD] dmr-client

Releases by Language

The SDK, CLI and Samples will be released within the next schedule

Platform Package Milestone Date
.NET Samples MVP GA 10/14
.NET SDK Internal Preview 10/14
.NET CLI Internal Preview 10/14
.NET SDK Public Preview TBD
.NET CLI Public Preview TBD
.NET SDK v1.0.0 TBD
.NET CLI v1.0.0 TBD
.NET Samples v1.0.0 TBD
Node SDK Internal Preview TBD
Node SDK Public Preview TBD
Node SDK v1.0.0 TBD
Node Samples v1.0.0 TBD
Python SDK Internal Preview TBD
Python SDK Public Preview TBD
Python SDK v1.0.0 TBD
Python Samples v1.0.0 TBD