A general-purpose editor inspired by Azure IoT Central's model editor currently supporting DTDLv2.
NOTE: This project currently supports NodeJS 20.11.1, Typescript 5.4.0, with Angular 17 and Material 17.
- Basic support for:
- Interfaces,
- Properties,
- Commands,
- Telemetry,
- Components,
- Relationships (and Properties)
- Command Request/Response payloads
- Semantic Types and Units
- Primitive Schema Types
- Complex Schema Types (Array, Map, Enum, Object)
- Interface Schemas
- Full DTDL validation
- Importing existing models
- Basic file management
- Copy/Save models locally
- Editor settings
- Set DTMI scheme, path, and version
- Set Context
- Selecting DTDLv3 annotations and extensions
- Full DTDLv3 annotation and extension support
- Advanced organization of models
- Model graph and visuals
- Basic model simulation features
- There are a few known issues related to importing models
- Component and Relationship references are limited
- Some issues when nesting Complex schema types (e.g., Map => Map, Object => Map, etc )
- No inline validation before submitting to validation API
Model validation is performed using Microsoft's DTDL model validator. This is exposed via HTTP API. See source code here: https://github.com/thern743/DTDL-Editor-Api
Update the environment.<env>.ts
files and set the apiUrl
to the correct location.
Model validation library: https://github.com/azure-samples/dtdl-validator/tree/master/
This project is particularly complicated by the fact that DTDL is a JSON-LD based specification. Much of the DTDL spec is unintuitive.
For instance, many attributes can either be a single string value or, optionally, an array/object (see @context
, @type
, and schema
). Another example are that some attributes are specifically called to be Sets of values as opposed to Array, List or Map (see contents
, extends
, and schemas
).
For more details on some design choices, see Philosophy and Design Notes.
Importing models makes use of the browser's local storage. File contents are saved locally only; there is no backend support for storing data.
-
Install NodeJS and
npm
. -
Install Angular globally:
npm install -g @angular/cli
-
Install npm packages:
npm update
Run ng serve
for a dev server. Navigate to http://localhost:4200/
. The app will automatically reload if you change any of the source files.
Run ng generate component component-name
to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module
.
Run ng build
to build the project. The build artifacts will be stored in the dist/
directory.
Run ng test
to execute the unit tests via Karma.
All forms are built using Angular Reactive Forms. There are two base interfaces from which all models and forms are constructed:
ICapabilityModel
ICapabilityFormControl<ICapabilityModel>
NOTE: These interfaces have base abstract class implementations.
All ICapabilityFormControl<T>
implementations wrap an instance of FormGroup
and ICapabilityModel
. This interface exposes two important methods:
toFormGroup()
- Creates the
FormGroup
instance from the backing model
- Creates the
subscribeModelToForm()
- Syncs the backing model to the
FormGroup
- Syncs the backing model to the